知乎的qq登录怎么用python和webdriver定位到“账号密码登录”?,pythonwebdriver,from seleniu


from selenium import webdriverimport timedriver = webdriver.Chrome()driver.set_window_size(640, 960)driver.get('http://m.zhihu.com/#signin')driver.execute_script('$(".js-bindqq")[0].click()')time.sleep(5)driver.switch_to.window(driver.window_handles[-1])driver.switch_to.frame(0)print driver.find_element_by_id('switcher_plogin').textdriver.execute_script('$("#switcher_plogin")[0].click()')

上面的print能输出'帐号密码登录',但是后面的click提示:WebDriverException: Message: unknown error: Cannot read property '0' of null

编橙之家文章,

评论关闭