How to Fix "[Severe]: Bind() Failed: Cannot Assign Requested Address (99)" While Starting Chromedriver

chrome webdriver fails when run from linux docker container with errors [1594905471.000][SEVERE]: bind() failed: Cannot assign requested address (99)]

Root cause: Cause lays in trying to launch a browser in the container.

Fix: Launch selenium in headless mode in your tests.
For Java, this is shown as below.
ChromeOptions options = new ChromeOptions().setHeadless(true);
WebDriver driver = new ChromeDriver(options);

Results: Now tests run successfully, without any errors.

socket.error:[errno 99] cannot assign requested address and namespace in python

Stripping things down to basics this is what you would want to test with:

import socket
server = socket.socket()
server.bind(("10.0.0.1", 6677))
server.listen(4)
client_socket, client_address = server.accept()
print(client_address, "has connected")
while True:
recvieved_data = client_socket.recv(1024)
print(recvieved_data)

This works assuming a few things:

  1. Your local IP address (on the server) is 10.0.0.1 (This video shows you how)
  2. No other software is listening on port 6677

Also note the basic concept of IP addresses:

Try the following, open the start menu, in the "search" field type cmd and press enter.
Once the black console opens up type ping www.google.com and this should give you and IP address for google. This address is googles local IP and they bind to that and obviously you can not bind to an IP address owned by google.

With that in mind, you own your own set of IP addresses.
First you have the local IP of the server, but then you have the local IP of your house.
In the below picture 192.168.1.50 is the local IP of the server which you can bind to.
You still own 83.55.102.40 but the problem is that it's owned by the Router and not your server. So even if you visit http://whatsmyip.com and that tells you that your IP is 83.55.102.40 that is not the case because it can only see where you're coming from.. and you're accessing your internet from a router.

Sample Image

In order for your friends to access your server (which is bound to 192.168.1.50) you need to forward port 6677 to 192.168.1.50 and this is done in your router.
Assuming you are behind one.

If you're in school there's other dilemmas and routers in the way most likely.

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

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.

Bind failed: Address already in use

The error usually means that the port you are trying to open is being already used by another application. Try using netstat to see which ports are open and then use an available port.

Also check if you are binding to the right ip address (I am assuming it would be localhost)



Related Topics



Leave a reply



Submit