The error “unknown error: cannot determine loading status from unknown error: unexpected command response” is an error that is invoked whenever you are coding in python and trying to use the selenium package. Given below is the snippet of the error:
selenium.common.exceptions.WebDriverException: Message: unknown error: cannot determine loading status from unknown error: unexpected command response
I would like to share with you the steps I took to fix the “unknown error: cannot determine loading status from unknown error: unexpected command response” in your project file.
Why “unknown error cannot determine loading status from unknown error unexpected command response” error is seen?
The error, “unknown error: cannot determine loading status from unknown error: unexpected command response” is seen because; this is an issue which is seen with the chrome driver 103 version. You can find the bug ids for the same in the link here.
As per reported bug on official chrome website as “unexpected command response”:
Chrome may process a CDP command request after the target CDP session is already detached and respond with a "session not found" error. If ChromeDriver receives this error response while waiting for another valid command to complete, then the other command will fail. Requested to be merged into ChromeDriver 103. Motivation: This is a regression. Users request it to be fixed in version 103.
The detailed solution to fix the error “unknown error: cannot determine loading status from unknown error: unexpected command response”, is given below:
How to fix the error, “unknown error cannot determine loading status from unknown error unexpected command response”?
To fix the error, you have to downgrade your chrome Browser To v102″ and “Download Selenium Chrome Driver 102”. You can also try to upgrade your chromedriver to v104 if the issue is not fixed.
To fix the error, “unknown error: cannot determine loading status from unknown error: unexpected command response”, follow one of the below-mentioned methods:
Method 1: Downgrade your Chrome Browser
To fix the error, “unknown error: cannot determine loading status from unknown error: unexpected command response”, you will have to downgrade your chrome Browser To v102″ and “Download Selenium Chrome Driver 102”. This should fixed the error as this is an error in the version 103
This should fix the error, “unknown error: cannot determine loading status from unknown error: unexpected command response”.
Method 2: Deleting easily Corrupted Folders
To fix the error, “unknown error: cannot determine loading status from unknown error: unexpected command response”, you will have to upgrade your chrome Browser To v104″. This should fixed the error as this is an error in version 103
A sample code of how to execute your code properly after have all the right versions to avoid any other errors.
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)
This should fix the error, “unknown error: cannot determine loading status from unknown error: unexpected command response”.
Conclusion
To fix the error “unknown error: cannot determine loading status from unknown error: unexpected command response”, you will have to downgrade your chrome Browser To v102″ and “Download Selenium Chrome Driver 102”. You can also try to upgrade your chromedriver to v104 if the issue is not fixed