How to fix “[SEVERE]: bind() failed: Cannot assign requested address (99)” while starting chromedriver

后端 未结 5 973
长发绾君心
长发绾君心 2020-12-06 10:52

I downloaded the latest version of chromedriver in Centos 7 platform: https://chromedriver.storage.googleapis.com/index.html?path=74.0.3729.6/ I start chromedriver and get

相关标签:
5条回答
  • 2020-12-06 11:06

    I had the similar problem; and my issue was i did not quit the existing driver and tried to use again. driver.quit() solved my problem.

    0 讨论(0)
  • 2020-12-06 11:11

    In one line: you need to pass --whitelisted-ips= into chrome driver (not chrome!)

    You can do it in different way (depend on your env setup):

    If you use ChromeDriver locally/directly (not using RemoteWebDriver) from code, just insert lines below before ChromeDriver init

        System.setProperty("webdriver.chrome.whitelistedIps", "");
    

    If you use it remotely (eg. selenium hub/grid) you need to set system property when node starts, like in command:

    java -Dwebdriver.chrome.whitelistedIps= testClass etc...
    

    or docker by passing JAVA_OPTS env

      chrome:
        image: selenium/node-chrome:3.141.59
        container_name: chrome
        depends_on:
          - selenium-hub
        environment:
          - HUB_HOST=selenium-hub
          - HUB_PORT=4444
          - JAVA_OPTS=-Dwebdriver.chrome.whitelistedIps=
    
    0 讨论(0)
  • 2020-12-06 11:17

    In my case, there we 2 docker containers running and the port 4444 used by selenium. Closing one container solved the issue for the other one. The message is still there, but the tests are running. Earlier they were getting stuck.

    0 讨论(0)
  • 2020-12-06 11:21

    The cause lay somewhere else. I was running chrome on docker container and for me this was solved when the driver was run in a headless mode.

    ChromeOptions options = new ChromeOptions().setHeadless(true); WebDriver driver = new ChromeDriver(options);

    Results: Now tests run successfully, without any errors.

    0 讨论(0)
  • 2020-12-06 11:27

    In my case running chromedriver with --verbose flag helped to figure out the issue:

    [1564749154.010][SEVERE]: bind() failed: Cannot assign requested address (99)
    [1564749154.011][INFO]: listen on IPv6 failed with error ERR_ADDRESS_INVALID
    

    Chrome attempted to listen on IPv6 address, which was not enabled in Docker. You can either enable IPv6 support (which works only on Linux host) or ignore the error since chromedriver process will be listening on IPv4 anyway.

    0 讨论(0)
提交回复
热议问题