我的代码,曾经工作到昨天,突然停止工作。我一直在运行jupyter笔记本中的代码来自动收集网页上的重复数据。它如下(出于隐私原因,URL已更改为Google):
---------------------------------------------------------------------------
WebDriverException Traceback (most recent call last)
<ipython-input-25-84be89301b0d> in <module>()
1 # use selenium to start Chrome session to open google.
----> 2 dr = webdriver.Chrome()
3 dr.get("http://www.google.com")
/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/selenium/webdriver/chrome/webdriver.py in __init__(self, executable_path, port, chrome_options, service_args, desired_capabilities, service_log_path)
65 command_executor=ChromeRemoteConnection(
66 remote_server_addr=self.service.service_url),
---> 67 desired_capabilities=desired_capabilities)
68 except:
69 self.quit()
/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py in __init__(self, command_executor, desired_capabilities, browser_profile, proxy, keep_alive)
85 self.error_handler = ErrorHandler()
86 self.start_client()
---> 87 self.start_session(desired_capabilities, browser_profile)
88 self._switch_to = SwitchTo(self)
89 self._mobile = Mobile(self)
/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py in start_session(self, desired_capabilities, browser_profile)
139 desired_capabilities['firefox_profile'] = browser_profile.encoded
140 response = self.execute(Command.NEW_SESSION, {
--> 141 'desiredCapabilities': desired_capabilities,
142 })
143 self.session_id = response['sessionId']
/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py in execute(self, driver_command, params)
199 response = self.command_executor.execute(driver_command, params)
200 if response:
--> 201 self.error_handler.check_response(response)
202 response['value'] = self._unwrap_value(
203 response.get('value', None))
/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/selenium/webdriver/remote/errorhandler.py in check_response(self, response)
179 elif exception_class == UnexpectedAlertPresentException and 'alert' in value:
180 raise exception_class(message, screen, stacktrace, value['alert'].get('text'))
--> 181 raise exception_class(message, screen, stacktrace)
182
183 def _value_or_default(self, obj, key, default):
WebDriverException: Message: session not created exception
from unknown error: Runtime.executionContextCreated has invalid 'context': {"auxData":{"frameId":"7600.1","isDefault":true},"id":1,"name":"","origin":"://"}
(Session info: chrome=54.0.2840.71)
(Driver info: chromedriver=2.20.353124 (035346203162d32c80f1dce587c8154a1efa0c3b),platform=Mac OS X 10.11.6 x86_64)
我收到的错误消息:
<html><body>
<form action="db1.nsf/mainDoc.xsp?doc1&action=openDocument"></form>
<div id="dialog">
<form action="db1.nsf/mainDoc.xsp?doc1&action=openDocument">
<iframe src="showDialog.xsp?databaseName=db2.nsf&doc2">
<html><body>
<form action="db1.nsf/showDialog.xsp?databaseName=db2.nsf&doc2&action=editDocument">
<button id="okBtn" type="submit">OK</button>
</form>
</body></html>
</iframe>
</form>
</div>
</body></html>
我真的不知道如何解决这个问题以及为什么我突然收到这条信息。
答案 0 :(得分:0)
从下方链接再次下载新的Chrome驱动程序并使用相同的
http://chromedriver.storage.googleapis.com/index.html?path=2.24/