35

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,
            
        )
3
  • 3
    have you checked your driver version is the same as your chrome version ? Commented Jun 26, 2022 at 13:57
  • 1
    So...I just downgraded my chromedriver to 102. And it works. My Chrome version is 103 though...so not sure how my code is working :/ Commented Jun 28, 2022 at 1:12
  • 1
    how do you downgrade? chrome auto-update policy is so annoying and doesn't seem to let me Commented Jul 1, 2022 at 11:50

8 Answers 8

20

You need to upgrade Google Chrome and your Chrome Driver to version 104:

  1. Install Google Chrome Beta from here: https://www.google.com/chrome/beta/

  2. Update ChromeDriver to 104 manually (it is not in brew yet) https://chromedriver.storage.googleapis.com/index.html?path=104.0.5112.20/

  3. 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"

Sign up to request clarification or add additional context in comments.

3 Comments

CHROME_OPTIONS.binary_location = "C:\Program Files\Google\Chrome Beta\Application\chrome.exe" just added that line before the chrome driver is initialized but yet when I execute the code the Beta version is not opened. Any idea of what I'm missing?
The following worked for me: options = webdriver.ChromeOptions() options.binary_location = "C:/Program Files/Google/Chrome Beta/Application/chrome.exe" wd = webdriver.Chrome('chromedriver',options=options)
I get this message with 104.0.5112.48 as well. Not for all websites though.
11

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).

1 Comment

In a tutorial I followed they recommended me using pyvirtualDisplay for my headless server and indeed it doesn't work without it :(
7

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

1 Comment

This just repeats the answer by Yi_Jian_Mei from 2 days prior.
5

I built in a static wait; it's not elegant, but it worked for my purpose:

import time

time.sleep(5)

4 Comments

Hi @David Adams, where exactly would you insert time.sleep(5)? Would that be before the driver.get(url) or after? I am answering it myself: you put the time.sleep(x) before driver.get(url). It worked for me. Thank you David for the suggestion!
@jqlifer1 I put the sleep after the driver.get(url) so that the page had time to load because that's what my automation needed. I'm glad putting it before your call worked in your application.
@dtadams79 - unfortunately, it is not working consistently for me. I even tried putting before AND after driver.get(url) but still does not work...I think I will just wait for the 104 version of chrome and chromedriver. I don't want to install beta chrome 104 as I don't want to lose all my personal user data (or bother trying to reload all of it)/
@jqlifer1 I added the following to my script in the pre-execution chrome driver initialization: <br/> driver.implicitly_wait(10) <br/> driver.set_script_timeout(10)
3

On chrome version 103, If you open the chrome with incognito and disabled site isolation trials it would not give this error

options = webdriver.ChromeOptions()
options.add_argument("--incognito")
options.add_argument("--disable-site-isolation-trials")
driver = webdriver.Chrome(chrome_options=options)

1 Comment

I found just adding "--disable-site-isolation-trials" worked for me
2

I think this will work but as a temporary workaround.

while True:
    try:
        driver.get('https://katalon.com/')
        break
    except:
        continue

Comments

0

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:

try:  
   next_elm.click()
except:
   pass

And then continuing with the rest of my code. Not a very elegant work-around, but it works in my application.

Comments

-1

Solution in Code:

from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service 
from webdriver_manager.chrome import ChromeDriverManager


# 1
option = Options()
option.binary_location='/Applications/Google Chrome 
Beta.app/Contents/MacOS/Google Chrome Beta'

# 2
driver = webdriver.Chrome(service=Service(ChromeDriverManager(version='104.0.5112.20').install()), options=option)

see: this thread

1 Comment

Can you please provide the actual thread link? I think you have put the code instead of the web link. Thank you. I am trying to understand how it will be for windows.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.