Selenium / Seleniumwire未知错误:无法确定未知错误的加载状态:意外命令响应
这是错误:
selenium.common.exceptions.WebDriverException: Message: unknown error: cannot determine loading status
from unknown error: unexpected command response
(Session info: chrome=103.0.5060.53)
我正在使用适当的WebDriver和Chrome版本:
这是脚本,其作业是从普通用户数据目录打开网页并提供响应。
from seleniumwire import webdriver # Import from seleniumwire
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("user-data-dir=C:\\selenium")
driver = webdriver.Chrome(chrome_options=chrome_options)
driver.get('https://katalon.com/
')
for request in driver.requests:
if request.response:
print(
request.response.status_code,
)
Here is the error:
selenium.common.exceptions.WebDriverException: Message: unknown error: cannot determine loading status
from unknown error: unexpected command response
(Session info: chrome=103.0.5060.53)
I'm using proper webdriver and chrome version:
Here is the script, its job is to open a webpage from the normal user data directory and provide a response.
from seleniumwire import webdriver # Import from seleniumwire
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("user-data-dir=C:\\selenium")
driver = webdriver.Chrome(chrome_options=chrome_options)
driver.get('https://katalon.com/
')
for request in driver.requests:
if request.response:
print(
request.response.status_code,
)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
您需要将Google Chrome和您的Chrome驱动程序升级到版本104:
从这里安装Google Chrome Beta: https://www.google.com/chrome/beta/
手动将ChromeDriver更新为104(尚未在啤酒中) https://chromedriver.storage.googleapis.com/index.html?path=104.0.5112.20/
设置
charome_options.binary_location.binary_location
:Windows - “ C:\ Program Files \ Google \ Google \ Chrome Beta \ Application \ Chrome.exe”
macos-“/applications/google chrome beta.app/contents/macos/google chrome beta”
You need to upgrade Google Chrome and your Chrome Driver to version 104:
Install Google Chrome Beta from here: https://www.google.com/chrome/beta/
Update ChromeDriver to 104 manually (it is not in brew yet) https://chromedriver.storage.googleapis.com/index.html?path=104.0.5112.20/
Set the
chrome_options.binary_location
:Windows - "C:\Program Files\Google\Chrome Beta\Application\chrome.exe"
MacOS - "/Applications/Google Chrome Beta.app/Contents/MacOS/Google Chrome Beta"
无头的ChromeDriver浏览器有一个已知问题,您可以阅读更多有关它的信息在这里。
到目前为止,还没有针对Chromedriver版本103或更少的修复程序。
编辑:这也已为Chromedriver版本103修复。从
您可以做什么:
升级到Chromedriver版本104,并按照Dmytro Durach的说明使用Google 104 Beta版本。该问题绝对可以解决,如 patch Notes for Chromedriver版本104。
使用无头浏览器。 指令>。
使用发现在这里。它似乎对几个人有用。
等到解决问题为止。据我所知,他们正在积极地从事它。任何更新都将发布在这里。
使用一个尝试...除了无限重试块(不建议)。
There is a known issue with non-headless chromedriver browsers, you can read more about it here.
As of now there has not been a fix for chromedriver version 103 or less.
EDIT: This has been fixed for Chromedriver version 103 as well. Download chromedriver's latest 103 version from here.
What you can do:
Upgrade to chromedriver version 104 and use the Google 104 Beta version, following Dmytro Durach's instructions. The issue is definitely fixed as seen in the patch notes for chromedriver version 104.
Use a headless browser. Instructions on configuring chromedriver headless.
Use the incognito workaround found here. It seems to work for a few people.
Wait until the issue is fixed. From what I can tell they are actively working on it. Any updates will be posted here.
Use a try...except block to infinitely retry (not recommended).
Chromedriver 103版本存在问题,Chromium社区也为此提出了一个问题。
请在下面找到相同的错误ID,
htttps:htttps:// bugs。 chromium.org/p/chromedriver/issues/detail?id=4121&; q = label%3amerge-request-103
您可以在上面的错误线程中看到所有对话。
目前, 直到修复此问题之前,请尝试“将Chrome浏览器降级为V102”和“下载Selenium Chrome Driver 102”并尝试运行您的脚本,因为此问题正在103版中发生 。
由于这个原因,硒社区已经关闭了有关同一问题的问题,因为该问题与Chrome团队有关。
https://github.com/seleniumhq/seleniumhq/selenium/issues/issues/10799
There has been issue with chromeDriver 103 version and there is an issue raised for the same with Chromium community.
Please find below the bug ids for the same,
https://bugs.chromium.org/p/chromedriver/issues/detail?id=4121&q=label%3AMerge-Request-103
You can see all the conversations in the above bug thread.
For now, until this issue is fixed try to "Downgrade Chrome Browser To v102" and "Download Selenium Chrome Driver 102" and try to run your script, as this issue is happening in 103 version.
Because of this reason, Selenium community has closed the issue with regard to the same because the issue is related to Chrome team.
https://github.com/SeleniumHQ/selenium/issues/10799
我在静态等待中建造;它不是优雅的,但它是为了我的目的:
I built in a static wait; it's not elegant, but it worked for my purpose:
在Chrome版本103上,如果您使用隐身和残疾的站点隔离试验打开Chrome,则不会给出此错误
On chrome version 103, If you open the chrome with incognito and disabled site isolation trials it would not give this error
我认为这将起作用,但作为临时解决方法。
I think this will work but as a temporary workaround.
我在Chrome ver = 103中获得了相同的报告错误:“消息:未知错误:无法从未知错误中确定加载状态:意外命令响应”,尽管我的错误是通过单击元素而产生的。
我尝试了上面列出的以下建议,这些建议是无效的:隐身模式,无头浏览器(对我的应用程序不起作用),增加时间。
(我目前不愿加载Chrome Beta版本104。)
此错误(至少在我的应用程序中)特有的是,当抛出异常时,我可以看到生成它的代码(单击元素)实际上按预期执行 - 实际上是单击的。
因此,我已经成功地忽略了以下代码的错误:
然后继续我的其余代码。
这不是一个非常优雅的工作,但它在我的应用程序中起作用。
I was getting the same reported error with Chrome ver=103: “Message: unknown error: cannot determine loading status from unknown error: unexpected command response”, although my error is generated from clicking an element.
I tried the following suggestions listed above which did not work: Incognito mode, headless browser (which would not work for my application), adding time.sleep(10).
(I am adverse to loading the Chrome beta version 104, at this time.)
What is peculiar about this error (at least in my application) is that while an exception is thrown, I can see that the code generating it (clicking an element) actually executes as expected - the element IS in fact clicked.
So I have had success with just ignoring the error with the following code:
And then continuing with the rest of my code.
Not a very elegant work-around, but it works in my application.
Solution in Code:
see:
Solution in Code:
see: this thread