Getting protocol error in Open Browser Keyword

Hello,

I have installed robot framework in docker. While trying to run a simple script to open browser, it gives error ProtocolError: (“Connection broken: ConnectionResetError(104, ‘Connection reset by peer’)”, ConnectionResetError(104, ‘Connection reset by peer’))

Here is my test case. Can some one please help

*** Settings ***
Library SeleniumLibrary

*** Variables ***
${BROWSER} chrome

*** Test Cases ***
Visit Bing
Open Browser https://www.bing.com ${BROWSER}
Capture Page Screenshot

Visit Google
Open Browser https://www.google.com ${BROWSER}
Capture Page Screenshot

Welcome to the Robot Framework Forum!

I would do a standard check on updating all the Python packages (Selenium, SeleniumLibrary, Robot Framework) to their latest. I would also check the Chrome Browser version and the chromedriver version making sure they match. Or allowing the new selenium-manager, which is bundled with selenium, to handle/check this. One last item is that I would make sure one is not running under root on the docker but as a user.

This last suggestions comes from some threads which people notice issues with browsers and drivers and make various suggestions on a fix. After checking the versions I might suggest these.

1 Like

Thanks for your reply.

Double checked the versions and they are on latest
robotframework-requests 0.9.5
robotframework-seleniumlibrary 6.1.0
robotframework 6.1
robotframework-assertion-engine 3.0.2
robotframework-browser 16.2.0

chromium-119.0.6045.123-1.fc38.x86_64
chromedriver-119.0.6045.123-1.fc38.x86_64
xorg-x11-server-Xvfb-1.20.14-26.fc38.x86_64

And I am running as a non root user.

Those versions all look good. My next guess would be docker configuration issues which I haven’t used docker in a while. Any way to log into the remote docker and explore from there?

Actually I ran the robot command inside the docker only where it throws the error. Not sure where I can get more logs of this to troubleshoot further

So searching on that error and “docker” I see others having issues; interesting many with Python involved - which I don’t know if this is just google knowing I am usually working with python or an actual trend.

There are some selenium / webdriver logs one can enable. See the selenium.dev docs.

Hello,

This issue is never resolved. I tried without using docker also. Its the same issue. Anything else you can help with to resolve?

Hi @ar.sumi,

I must have missed this thread back in November…

Normally when I see an error like this is because of a firewall rule blocking the connection.

  • Is this docker running in your office environment?
  • when you run it without docker, are you running in your office environment?
  • do you need to configure a proxy server to be able to access the internet?

If I’m right find out what your local proxy settings are (you can probably find them in the browser settings of your local desktop), there’s threads in this forum about configuring proxies for SeleniumLibrary.

Hope that helps,

Dave.

  • when you run it without docker, are you running in your office environment?
    I tried with and without office environment. Same issue. In office env, I did set proxy and still same error

  • do you need to configure a proxy server to be able to access the internet?

Depends on your environment, in some office environments no, in most yes, but only your site IT people can tell you that for sure.

I don’t think those environment variables have any impact on SeleniumLibrary, I think you need to pass the proxy settings to Open Browser or Create Webdriver

Dave.

Ok Thanks

I created like this

and calling Open Chrome Browser now lands in here

Admin enters correct credentials :: Login To Wavelinx Configurator… | FAIL |
NoSuchDriverException: Message: Unable to obtain driver for chrome using Selenium Manager.; For documentation on this error, please visit: Unable to Locate Driver Error | Selenium

Test | FAIL |
1 test, 0 passed, 1 failed

Hi @ar.sumi,

Unless it got chopped off in your screenshot I don’t see that you called Open Browser after Create Webdriver?

Create Webdriver doesn’t open a browser window, it just creates a modified Webdriver selenium instance to be used by Open Browser, Open Browser is the keyword that tells selenium to open the browser window.

Go To needs a browser window open to work, so that would explain that error.

Dave.

Hello @damies13
I changed the create Webdriver to Open Browser keyword and now it works.
Tried the same versions and code in Docker and it still throws the error
Admin enters correct credentials :: Login To Wavelinx Configurator… | FAIL |
ProtocolError: (“Connection broken: ConnectionResetError(104, ‘Connection reset by peer’)”, ConnectionResetError(104, ‘Connection reset by peer’))

Hi @ar.sumi,

As I mentioned before this error is caused by your network configuration, usually a firewall but can also be the proxy server not allowing your network traffic through.

The fact you got it working on your local machine is a good starting point because now you have a way to show the script itself works

I obviously don’t know anything about your network setup so I don’t know what the fix will be, you will need to work with your network admins to identify why the script can connect to the proxy from your desktop but not from the docker container.

A suggestion of what it might be (this is just a guess):

  • The docker container’s IP address is in a different subnet from your desktop, this might be fixed by:
    • changing the docker configuration so the container gets a IP address in different subnet
    • Network admins change the proxy or firewall to also allow the ip range of the docker container
    • network admins give you a different proxy server to connect to

Unfortunately the issue your facing now is well outside anything that can be controlled in robot framework so it’s up to your network admins now.

Dave.