在使用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()