WebDriverException: unknown error: DevToolsActivePort file doesn't exist while trying to initiate Chrome Browser

前端 未结 29 3444
旧巷少年郎
旧巷少年郎 2020-11-21 07:11

I am trying to launch chrome with an URL, the browser launches and it does nothing after that.

I am seeing the below error after 1 minute:

Unable to         


        
相关标签:
29条回答
  • 2020-11-21 07:32

    I ran into the same issue running Chrome via Behat/Mink and Selenium in a Docker container. After some fiddling, I arrived at the following behat.yml which supplies the switches mentioned above. Note that all of them were required for me to get it running successfully.

    default:
        extensions:
            Behat\MinkExtension:
                base_url: https://my.app/
                default_session: selenium2
                selenium2:
                    browser: chrome
                    capabilities:
                        extra_capabilities:
                            chromeOptions:
                                args:
                                    - "headless"
                                    - "no-sandbox"
                                    - "disable-dev-shm-usage"
    
    0 讨论(0)
  • 2020-11-21 07:32

    It happens when chromedriver fails to figure out what debugging port chrome is using.

    One possible cause is an open defect with HKEY_CURRENT_USER\Software\Policies\Google\Chrome\UserDataDir

    But in my last case, it was some other unidentified cause.

    Fortunately setting port number manually worked:

    final String[] args = { "--remote-debugging-port=9222" };
    options.addArguments(args);
    WebDriver driver = new ChromeDriver(options);
    
    0 讨论(0)
  • 2020-11-21 07:32

    Wrong port number in my case. Check if port number when starting Selenium server is the same as in your script.

    0 讨论(0)
  • 2020-11-21 07:32

    I solve this problem by installing yum -y install gtk3-devel gtk3-devel-docs", it works ok

    My work env is :

    Selenium Version 3.12.0
    ChromeDriver Version v2.40
    Chrome 68 level
    

    Before:
    enter image description here enter image description here

    After:
    enter image description here enter image description here

    0 讨论(0)
  • 2020-11-21 07:34

    Update:

    I am able to get through the issue and now I am able to access the chrome with desired url.

    Results of trying the provided solutions:

    I tried all the settings as provided above but I was unable to resolve the issue

    Explanation regarding the issue:

    As per my observation DevToolsActivePort file doesn't exist is caused when chrome is unable to find its reference in scoped_dirXXXXX folder.

    Steps taken to solve the issue

    1. I have killed all the chrome processes and chrome driver processes.
    2. Added the below code to invoke the chrome

      System.setProperty("webdriver.chrome.driver","pathto\\chromedriver.exe");    
      ChromeOptions options = new ChromeOptions();
      options.setExperimentalOption("useAutomationExtension", false);
      WebDriver driver = new ChromeDriver(options);
      driver.get(url);
      

    Using the above steps I was able to resolve the issue.

    Thanks for your answers.

    0 讨论(0)
  • 2020-11-21 07:36

    I also faced this issue while integrating with jenkins server, I was used the root user for jenkin job, the issue was fixed when I changed the user to other user. I am not sure why this error occurs for the root user.

    • Google Chrome Version 71.0
    • ChromeDriver Version 2.45
    • CentOS7 Version 1.153
    0 讨论(0)
提交回复
热议问题