来自chrome

时间:2016-11-21 22:59:03

标签: python google-chrome selenium

我正在尝试解析网站上可用的数据并首次使用selenium。在Stack Overflow上查看多个帖子后,我能够找出错误的PATH。现在,当我运行脚本时,命令行显示(对于Python27 / Scripts)并且chrome打开一两秒(使用url = data)然后脚本爆炸。我不是那么流利的Python,所以我不明白错误。我不知道为什么Chrome浏览器会在网址中打开数据。请就此事提供建议。

from selenium import webdriver


driver = webdriver.Chrome("C:\Python27\Scripts\chromedriver.exe")
driver.get("https://etrakit.friscotexas.gov/Search/permit.aspx")

错误:

Traceback (most recent call last):
  File "C:\Users\jose\Desktop\Programming\aspxscraping.py", line 4, in <module>
    driver = webdriver.Chrome("C:\Python27\Scripts\chromedriver.exe")
    File "C:\Python27\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 69, in __init__
    desired_capabilities=desired_capabilities)
  File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 92, in __init__
    self.start_session(desired_capabilities, browser_profile)
  File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 179, in start_session
    response = self.execute(Command.NEW_SESSION, capabilities)
  File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 236, in execute
    self.error_handler.check_response(response)
  File "C:\Python27\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 192, in check_response
    raise exception_class(message, screen, stacktrace)
WebDriverException: Message: session not created exception
from unknown error: Runtime.executionContextCreated has invalid 'context': {"auxData":{"frameId":"15736.1","isDefault":true},"id":1,"name":"","origin":"://"}
  (Session info: chrome=54.0.2840.71)
  (Driver info: chromedriver=2.15.322448(52179c1b310fec1797c81ea9a20326839860b7d3),platform=Windows NT 6.1 SP1 x86_64)

1 个答案:

答案 0 :(得分:1)

看起来你正在运行旧版的chromedriver(2.15)。最新的是2.25。 2.24和2.25应与您的Chrome版本一起使用(54)。尝试updating your chromedriver并再次运行。

相关问题