爬虫学习1-登录淘宝
工作需要学习一下爬虫,借鉴文章https://zhuanlan.zhihu.com/p/85663187。
在文章提供的代码上发现一些问题,记录一下。
作者的代码:
selenium以mitmproxy作为代理正常启动打开淘宝登录
from selenium import webdriver
from selenium.webdriver import ChromeOptions
option = ChromeOptions()
option.add_argument('--proxy-server=http://127.0.0.1:12345')
b = webdriver.Chrome(options=option)
b.get('https://login.taobao.com/member/login.jhtml')
b.find_element_by_link_text('密码登录').click()
b.find_element_by_id('fm-login-id').send_keys('你的账号')
b.find_element_by_id('fm-login-password').send_keys('你的密码')
b.find_element_by_tag_name('button').click()
input('hahahahhahaha')
我在启动后出现的问题:
解决办法,增加启动参数:
option.add_argument(‘ignore-certificate-errors’)