gpt4 book ai didi

python - selenium.common.exceptions.WebDriverException : Message: unknown error: unable to discover open pages while test execution through InstaPy and selenium

转载 作者:行者123 更新时间:2023-12-01 09:12:33 26 4
gpt4 key购买 nike

我想在基于 this instructions 的 Windows 上运行 InstaPy所以我一直安装到第 3 步,然后进入高级设置。因为简单的设置对我来说不起作用。现在我已经安装了来自an .exe setup file的GUI工具运行机器人将打开一个像这样的 chrome 页面,一段时间后我收到以下附加错误。我该怎么办?我哪里出错了?

我的 google chrome 版本 68.0.3440.75(官方版本)(64 位),目前我使用 chromedriver.exe 版本 2.4 和 python 3.6.5

首先我看到这个 chrome 页面: enter image description here

之后我在 GUI 中看到此错误 enter image description here错误是这样的

Error: ERROR [2018-07-26 11:16:27] [mohammad.f.rasoulnejad] Message: unknown error: unable to discover open pages
(Driver info: chromedriver=2.4.226107,platform=Windows NT 6.3 x86_64)
Traceback (most recent call last):
File "C:\Users\Mohammad\Desktop\InstaPy\instapy\instapy.py", line 295, in set_selenium_local_session
chrome_options=chrome_options)
File "D:\web\Python 3.6.5\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 69, in __init__
desired_capabilities=desired_capabilities)
File "D:\web\Python 3.6.5\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 90, in __init__
self.start_session(desired_capabilities, browser_profile)
File "D:\web\Python 3.6.5\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 177, in start_session
response = self.execute(Command.NEW_SESSION, capabilities)
File "D:\web\Python 3.6.5\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 236, in execute
self.error_handler.check_response(response)
File "D:\web\Python 3.6.5\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 192, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: unable to discover open pages
(Driver info: chromedriver=2.4.226107,platform=Windows NT 6.3 x86_64)

Traceback (most recent call last):
File "C:\Users\Mohammad\Desktop\InstaPy\instapy\instapy.py", line 295, in set_selenium_local_session
chrome_options=chrome_options)
File "D:\web\Python 3.6.5\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 69, in __init__
desired_capabilities=desired_capabilities)
File "D:\web\Python 3.6.5\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 90, in __init__
self.start_session(desired_capabilities, browser_profile)
File "D:\web\Python 3.6.5\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 177, in start_session
response = self.execute(Command.NEW_SESSION, capabilities)
File "D:\web\Python 3.6.5\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 236, in execute
self.error_handler.check_response(response)
File "D:\web\Python 3.6.5\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 192, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: unable to discover open pages
(Driver info: chromedriver=2.4.226107,platform=Windows NT 6.3 x86_64)


During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "quickstart.py", line 3, in <module>
session = InstaPy(username='mohammad.f.rasoulnejad', password='myPassword')
File "C:\Users\Mohammad\Desktop\InstaPy\instapy\instapy.py", line 188, in __init__
self.set_selenium_local_session()
File "C:\Users\Mohammad\Desktop\InstaPy\instapy\instapy.py", line 299, in set_selenium_local_session
Settings.chromedriver_location))
instapy.instapy.InstaPyError: ensure chromedriver is installed at C:\Users\Mohammad\Desktop\InstaPy\assets\chromedriver
InstaPy ended

更新:我下载了 2.40 并将其放在 Assets 文件夹中,但错误消息中显示了 2.4.226107chromedriver=2.4.226107

DevTools listening on ws://127.0.0.1:12969/devtools/browser/c5a3dd55-34fb-4723-9161-6b8a6e469b29
ERROR [2018-07-26 12:58:34] [mohammad.f.rasoulnejad] Message: unknown error: unable to discover open pages
(Driver info: chromedriver=2.4.226107,platform=Windows NT 6.3 x86_64)
Traceback (most recent call last):
File "C:\Users\Mohammad\Desktop\InstaPy\instapy\instapy.py", line 295, in set_selenium_local_session
chrome_options=chrome_options)
File "D:\web\Python 3.6.5\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 69, in __init__
desired_capabilities=desired_capabilities)
File "D:\web\Python 3.6.5\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 90, in __init__
self.start_session(desired_capabilities, browser_profile)
File "D:\web\Python 3.6.5\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 177, in start_session
response = self.execute(Command.NEW_SESSION, capabilities)
File "D:\web\Python 3.6.5\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 236, in execute
self.error_handler.check_response(response)
File "D:\web\Python 3.6.5\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 192, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: unable to discover open pages
(Driver info: chromedriver=2.4.226107,platform=Windows NT 6.3 x86_64)

Traceback (most recent call last):
File "C:\Users\Mohammad\Desktop\InstaPy\instapy\instapy.py", line 295, in set_selenium_local_session
chrome_options=chrome_options)
File "D:\web\Python 3.6.5\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 69, in __init__
desired_capabilities=desired_capabilities)
File "D:\web\Python 3.6.5\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 90, in __init__
self.start_session(desired_capabilities, browser_profile)
File "D:\web\Python 3.6.5\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 177, in start_session
response = self.execute(Command.NEW_SESSION, capabilities)
File "D:\web\Python 3.6.5\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 236, in execute
self.error_handler.check_response(response)
File "D:\web\Python 3.6.5\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 192, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: unable to discover open pages
(Driver info: chromedriver=2.4.226107,platform=Windows NT 6.3 x86_64)


During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "quickstart.py", line 3, in <module>
session = InstaPy(username='mohammad.f.rasoulnejad', password='myPassword')
File "C:\Users\Mohammad\Desktop\InstaPy\instapy\instapy.py", line 188, in __init__
self.set_selenium_local_session()
File "C:\Users\Mohammad\Desktop\InstaPy\instapy\instapy.py", line 299, in set_selenium_local_session
Settings.chromedriver_location))
instapy.instapy.InstaPyError: ensure chromedriver is installed at C:\Users\Mohammad\Desktop\InstaPy\assets\chromedriver

最佳答案

此错误消息...

Message: unknown error: unable to discover open pages

...表示 ChromeDriver 无法通过 Chrome 浏览器启动/生成新的 WebBrowsing session 。

您的主要问题是您使用的二进制文件版本之间不兼容,如下所示:

  • 您正在使用 chromedriver=2.4
  • chromedriver=2.4 非常古老古老
  • 您正在使用Google Chrome 版本 68.0.3440.75(官方版本)(64 位)
  • ChromeDriver v2.40 的发行说明明确提到以下内容:

Supports Chrome v66-68

因此,ChromeDriver v2.4Chrome 浏览器 v68.0 之间存在明显不匹配

<小时/>

解决方案

  • 由于您使用的是 Google Chrome 版本 68.0.3440.75,根据 Release Notes您需要使用兼容的 ChromeDriver 二进制文件。
  • ChromeDriver - WebDriver for Chrome 下载兼容的 ChromeDriver 二进制文件,即 ChromeDriver v2.40 (2018-06-07) .
<小时/>

更新

正如您所提到的,即使升级到 chromedriver=2.40 后,您仍然将 ChromeDriver 版本设置为 chromedriver=2.4,您可以覆盖通过明确提及参数executable_path,在 OS PATH 中更新以前的版本,如下所示:

from selenium import webdriver

driver = webdriver.Chrome(executable_path=r'C:\path\to\chromedriver.exe')

关于python - selenium.common.exceptions.WebDriverException : Message: unknown error: unable to discover open pages while test execution through InstaPy and selenium,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51532831/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com