#coding:utf-8
from selenium import webdriver
import time,os,sys
def withoutCookieLogin(url):
options = webdriver.ChromeOptions()
driver = webdriver.Chrome(chrome_options=options)
options.add_argument('lang=zh_CN.UTF-8')
options.add_argument("user-agent='Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36'")
driver.maximize_window()
driver.get(url)
driver.find_element_by_class_name('tab-log-type pull-right').click()
driver.find_element_by_id('uc-common-account').clear()
driver.find_element_by_id('uc-common-account').send_keys("name")
driver.find_element_by_id('ucsl-password-edit').clear()
driver.find_element_by_id('ucsl-password-edit').send_keys("password")
authCode = input('输入验证码')
driver.find_element_by_id('uc-common-token').send_keys(authCode)
driver.find_element_by_id(u'submit-form').click()
return driver
driver = withoutCookieLogin("http://cas.baidu.com/?tpl=www2&fromu=http%3A%2F%2Fwww2.baidu.com%2F")`请输入代码`
其他网站都没问题,凤巢后台搜寻不到element,有注意到打开的chrome浏览器是看不到element,右键对body进行edit as html,然后才能看到,python新手,求大手子指教,感谢!