Selenium学习(三)Selenium总是崩溃的解决办法

在使用selenium打开浏览器总是崩溃,最近查资料获得可行的解决办法:

 1 import sys
 2 from selenium import webdriver
 3 
 4 p = __import__('selenium.webdriver.firefox.webdriver',fromlist=('WebDriver'))    #####
 5 url = 'https://www.zhihu.com/#signin'
 6 driver = p.WebDriver()            #####
 7 driver.get(url)
 8 
 9 element = driver.find_element_by_name("account")
10 element.send_keys('xxxx')
11 element = driver.find_element_by_name("password")
12 element.send_keys('xxxxx')
13 element = driver.find_element_by_css_selector("button.sign-button.submit")
14 element.click()

 

posted @ 2016-10-14 20:36  lyzhou  阅读(2619)  评论(0编辑  收藏  举报