Only local connections are allowed Chrome and Selenium webdriver

前端 未结 12 1705
误落风尘
误落风尘 2020-11-30 05:59

I am using Chrome webdriver 2.23 & Selenium 2.53.1. I have tried a lot, but could not get it fixed. Whenever I run my selenium script, it is giving me the following err

12条回答
  •  长情又很酷
    2020-11-30 06:16

    First off, What you are seeing is not an error. It is an informational message.

    When you run this driver, it will enable your scripts to access this and run commands on Google Chrome.

    This can be done via scripts running in the local network (Only local connections are allowed.) or via scripts running on outside networks (All remote connections are allowed.). It is always safer to use the Local Connection option. By default your Chromedriver is accessible via port 9515.

    See this answer if you wish to allow all connections instead of just local.


    If your Chromedriver only shows the above two messages (as per the question), then there is a problem. It has to show a message like this, which says it started successfully.

    Starting ChromeDriver 83.0.4103.39 (ccbf011cb2d2b19b506d844400483861342c20cd-refs/branch-heads/4103@{#416}) on port 9515
    Only local connections are allowed.
    Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
    ChromeDriver was started successfully.
    

    To troubleshoot this...

    Step 1: Check your Chromedriver version

    $ chromedriver --version
    
    ChromeDriver 83.0.4103.39 (ccbf011cb2d2b19b506d844400483861342c20cd-refs/branch-heads/4103@{#416})
    

    My version is 83.0.4103.39.

    Step 2: Check your Chrome Browser version

    Open Google Chrome.

    Options --> Help --> About Google Chrome
    

    Or open a terminal and run the following command (works on Ubuntu).

    $ google-chrome --version
    
    Google Chrome 83.0.4103.61
    

    My version is: Version 83.0.4103.61

    Step 3: Compare versions of Chromedriver and Google Chrome

    Both these versions are starting with 83, which means they are both compatible. Hence, you should see a message like below, when you run the below command.

    $ chromedriver 
    
    Starting ChromeDriver 83.0.4103.39 (ccbf011cb2d2b19b506d844400483861342c20cd-refs/branch-heads/4103@{#416}) on port 9515
    Only local connections are allowed.
    Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
    ChromeDriver was started successfully. 
    

    If your versions mismatch, then you will see the following message. You will not see the line which says, ChromeDriver was started successfully..

    $ chromedriver
    
    Starting ChromeDriver 80.0.3987.106 (f68069574609230cf9b635cd784cfb1bf81bb53a-refs/branch-heads/3987@{#882}) on port 9515
    Only local connections are allowed.
    Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
    

    Step 4: Download the correct version of Chromedriver

    Download the correct version that matches your browser version. Use this page for downloads. After you download, extract the content, and move it to one of the following two folders. Open each of the following two folders and see whether your current Chromedriver is there. If it is on both folders, replace both. And do STEP 3 again.

    /usr/bin/chromedriver
    /usr/local/bin/chromedriver
    

提交回复
热议问题