我正试图从网站上搜集 我正在尝试通过脚本打开带有chromedriver的URL。它确实打开了chrome但它没有插入url。这是我的代码:
from selenium import webdriver
path_to_chromedriver = '/Users/***/Downloads/chromedriver'
browser = webdriver.Chrome(executable_path = path_to_chromedriver)
url = 'https://www.lexisnexis.com/hottopics/lnacademic/?verb=sf&sfi=AC00NBGenSrch'
browser.get(url)
我收到以下错误:
Traceback (most recent call last):
File "/Users/***/Downloads/test.py", line 6, in <module>
browser.get(url)
File "/Library/Python/2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 320, in get
self.execute(Command.GET, {'url': url})
File "/Library/Python/2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 308, in execute
self.error_handler.check_response(response)
File "/Library/Python/2.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 194, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: Runtime.executionContextCreated has invalid 'context': {"auxData":{"frameId":"31081.1","isDefault":true},"id":1,"name":"","origin":"://"}
(Session info: chrome=61.0.3163.100)
(Driver info: chromedriver=2.9.248307,platform=Mac OS X 10.9.5 x86_64)
我该怎么做才能插入网址?
答案 0 :(得分:0)
Chromedriver 2.9版本已经过时了。
尝试从here
下载最新的chromedriver
版本
请注意,尽管releases list page订单的实际订单类似于
2.1
...
2.9
2.10
...
2.32
答案 1 :(得分:0)
不完全确定错误的原因,但我肯定会建议下载更新版本的chromedriver
https://sites.google.com/a/chromium.org/chromedriver/downloads
我还建议更新selenium(来自终端):pip install -U pip selenium