每当我尝试它时,Chrome意外关闭并要求重新打开。在python结束时,它给出了错误:
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: was killed
(Driver info: chromedriver=2.0,platform=Mac OS X 10.10.2 x86_64)
我的代码是:
driver = None
profile = webdriver.Chrome('/Setups/chromedriver')
driver.set_window_size(1128, 768) # optional
url = 'http://google.com'
driver.get(url)
更新:以详细模式运行会产生以下结果:
答案 0 :(得分:0)
您正在尝试设置none
对象的大小。尝试
driver = webdriver.Chrome('/Setups/chromedriver')
driver.set_window_size(1128, 768)