Python Selenium:无法打开Chrome浏览器

时间:2016-01-23 14:05:37

标签: python google-chrome selenium

每当我尝试它时,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)

更新:以详细模式运行会产生以下结果:

enter image description here

1 个答案:

答案 0 :(得分:0)

您正在尝试设置none对象的大小。尝试

driver = webdriver.Chrome('/Setups/chromedriver')
driver.set_window_size(1128, 768)