The process started from chrome location C:\..\Chrome\Application\chrome.exe is no longer running, so ChromeDriver is assuming that Chrome has crashed
12,141
Solution 1
Today I was the same trouble and I fixed using:
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
o = webdriver.ChromeOptions()
o.add_argument("disable-extensions")
o.add_argument("--start-maximized")
o.binary_location = "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" ## This line define path of browser. In this case, Google Chrome
driver = webdriver.Chrome(executable_path=r"chromedriver.exe",options=o)
driver.get("http://www.python.org")
assert "Python" in driver.title
elem = driver.find_element_by_name("q")
elem.clear()
elem.send_keys("pycon")
elem.send_keys(Keys.RETURN)
assert "No results found." not in driver.page_source
driver.close()
Solution 2
I recently had this issue using TeamCity, which was caused by chrome (and chromedriver) not shutting down after executing my script. inserting "taskkill /f /im chrome.exe" and "taskkill /f /im chromedriver.exe" fixed this issue.
Solution 3
use correct argument for disabling extension:
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.chrome.options import Options
o = Options()
#o.add_argument("--disable-extensions"); #here
o.add_experimental_option("useAutomationExtension", false); #you can try this as well
o.add_argument("--start-maximized");
driver = webdriver.Chrome(executable_path=r"chromedriver.exe",chrome_options=o)
driver.get("http://www.python.org")
assert "Python" in driver.title
elem = driver.find_element_by_name("q")
elem.clear()
elem.send_keys("pycon")
elem.send_keys(Keys.RETURN)
assert "No results found." not in driver.page_source
driver.close()
Comments
-
assaf.b over 1 year
Chrome version: 68.0.3440.106
Chrome webdriver version: ChromeDriver 2.41.578737
Python Version : Python 3.5.2I write this code in python:
from selenium import webdriver from selenium.webdriver.common.keys import Keys o = webdriver.ChromeOptions() o.add_argument("disable-extensions"); o.add_argument("--start-maximized"); driver = webdriver.Chrome(executable_path=r"chromedriver.exe",options=o) driver.get("http://www.python.org") assert "Python" in driver.title elem = driver.find_element_by_name("q") elem.clear() elem.send_keys("pycon") elem.send_keys(Keys.RETURN) assert "No results found." not in driver.page_source driver.close()
after few seconds chrome opened with this error:
and nothing happend till i close chrome and get this exception:Traceback (most recent call last): File ".../game.py", line 8, in <module> driver = webdriver.Chrome(executable_path=r"chromedriver.exe",options=o) File "...\Python\Python35-32\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 75, in __init__ desired_capabilities=desired_capabilities) File "...\Python\Python35-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 156, in __init__ self.start_session(capabilities, browser_profile) File "...\Python\Python35-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 251, in start_session response = self.execute(Command.NEW_SESSION, parameters) File "...\Python\Python35-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 320, in execute self.error_handler.check_response(response) File "...\Python\Python35-32\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited normally (unknown error: unable to discover open pages) (The process started from chrome location C:\Program Files (x86)\Google\Chrome\Application\chrome.exe is no longer running, so ChromeDriver is assuming that Chrome has crashed.) (Driver info: chromedriver=2.41.578737 (49da6702b16031c40d63e5618de03a32ff6c197e),platform=Windows NT 10.0.17134 x86_64)
-
theGuy over 5 yearssee this post: Selenium Crashing: Chrome automation extension has crashed
-
assaf.b over 5 yearssaw, didn't helped.
-
theGuy over 5 yearsyou are not using correct argument, use: o.add_argument("--disable-extensions");
-
-
theGuy over 5 yearsyou can try one more option: o.setExperimentalOption("useAutomationExtension", false); This capability will help to not load Chrome Automation extension. I have updated my answer.
-
assaf.b over 5 yearsstill didn't work, in python is
o.add_experimental_option("useAutomationExtension", False)
-
theGuy over 5 yearsmy bad, you are right. I mixed up python and java. Btw are you still getting same error?
-
assaf.b over 5 yearsThe chrome was opened but after I close the window (after alot of time without any response but the error massage) I get this exception, your answer doesn't help me at all, but thanks for the try.
-
Oliver.R about 4 yearsCan you explain which part you changed to fix this issue?
-
Lucas Tula about 4 yearsOliver, add this line: o.binary_location = "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" ## This line define path of browser. In this case, Google Chrome