How to fix “[SEVERE]: bind() failed: Cannot assign

2020-02-14 05:49发布

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 this error.

Error :

Starting ChromeDriver 74.0.3729.6 (255758eccf3d244491b8a1317aa76e1ce10d57e9-refs/branch-heads/3729@{#29}) on port 9515 Only local connections are allowed. Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code. [1556179366.141][SEVERE]: bind() failed: Cannot assign requested address (99)

How can I solve this?

enter image description here

3条回答
欢心
2楼-- · 2020-02-14 06:32

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.

查看更多
在下西门庆
3楼-- · 2020-02-14 06:45

That error means that the port/address combination is already in use

This either means

  • You've run the program twice, it went wrong or stopped in the first attempt and the port/address wasn't closed correctly
  • there is some other program on your computer that is already using that address

To see open ports on a host, use command netstat -vatn. This will give quite a lot of output! To check if 9515 is in use, filter the output with grep like this netstat -vatn |grep 9515

Probably all you need to do is wait a few minutes for the socket to time out and try again

UPDATE: there is an option in chromedriver that must be set, here is a way of doing this with docker. Note that that the --whitelisted-ips is followed by nothing: it is forced as unset. To make this work you need a copy of the chromedriver zip in the directory the docker command is run from

x-Mac$ docker run -it -v $(pwd):/root/stuff -p 9515:9515 centos/python-36-centos7 /bin/bash -c "cd /tmp; unzip /root/stuff/chromedriver_linux64.zip; ./chromedriver --whitelisted-ips="
查看更多
forever°为你锁心
4楼-- · 2020-02-14 06:48

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.

查看更多
登录 后发表回答