The process started from chrome location C:\..\Chrome\Application\chrome.exe is no longer running, so ChromeDriver is assuming that Chrome has crashed

后端 未结 3 2785
鱼传尺愫
鱼传尺愫 2020-12-06 09:08

Chrome version: 68.0.3440.106
Chrome webdriver version: ChromeDriver 2.41.578737
Python Version : Python 3.5.2

I write this code in python:



        
相关标签:
3条回答
  • 2020-12-06 09:20

    This error message...

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

    ...implies that the ChromeDriver was unable to initiate/spawn a new WebBrowser i.e. Chrome Browser session.

    Your main issue seems that the chrome binary i.e. chrome.exe and the associated files are no more available/accessible from the default location of:

    C:\Program Files (x86)\Google\Chrome\Application\
    

    The possible reasons are:

    • Chrome previously installed at the default location got corrupted/deleted.
    • If you have installed Chrome Browser at a non-standard location you need to do:

      opt = webdriver.ChromeOptions()
      opt.binary_location("/path/to/other/chrome/binary");
      
    • Here you find a detailed discussion on Cannot find Chrome binary with Selenium in Python for older versions of Google Chrome


    Additional considerations

    • Chrome and ChromeDriver are present in the desired location.
    • Chrome and ChromeDriver are having executable permission for non-root (non-administrator) users.
    • Upgrade Selenium to current levels Version 3.14.0.
    • Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
    • (WindowsOS only) Use CCleaner tool to wipe off all the OS chores before and after the execution of your Test Suite.
    • (LinuxOS only) Free Up and Release the Unused/Cached Memory in Ubuntu/Linux Mint before and after the execution of your Test Suite.
    • If your base Web Client version is too old, then uninstall it through Revo Uninstaller and install a recent GA and released version of Web Client.
    • Take a System Reboot.
    • Execute your @Test as a non-root user.
    • Run the selenium server with webdriver-manager start from the machine with the desktop (don't use a remote session to start the selenium server).
    0 讨论(0)
  • 2020-12-06 09:25

    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()
    
    0 讨论(0)
  • 2020-12-06 09:42

    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()
    
    0 讨论(0)
提交回复
热议问题