Bypass connection to the net in seleniumLibrary Open Browser

Hello all,
After a long time on an old version of robotFramework, I take today the lastest version and under a docker in addition…

To test and update myself, I do a simple test on firefox of the Open Browser of the SelemiumLibrary lib. It works, but each call takes 10 seconds
post call selenium manager for download browser/driver which will never happen because I am not connected to the net (cf debug trace).

Despite everything I read about “options”, I did not manage to bypass this step. do you have a syntax? an idea how to do please…

thank you very much

Fabrice

Starting test: PREMIERTEST.VIncent.TestWebDriver
20241210 14:53:52.568 : INFO : Opening browser ‘Firefox’ to base url ‘about:blank’.
20241210 14:53:52.572 : DEBUG : Selenium Manager binary found at: /usr/local/lib/python3.11/site-packages/selenium/webdriver/common/linux/selenium-manager
20241210 14:53:52.572 : DEBUG : Executing process: /usr/local/lib/python3.11/site-packages/selenium/webdriver/common/linux/selenium-manager --browser firefox --debug --language-binding python --output json
20241210 14:54:02.703 : DEBUG : Sending stats to Plausible: Props { browser: “firefox”, browser_version: “”, os: “linux”, arch: “x86_64”, lang: “python”, selenium_version: “4.27” }
20241210 14:54:02.704 : DEBUG : Found geckodriver 0.35.0 in PATH: /usr/local/bin/geckodriver
20241210 14:54:02.704 : DEBUG : firefox detected at /usr/bin/firefox
20241210 14:54:02.704 : DEBUG : Running command: /usr/bin/firefox -v
20241210 14:54:02.704 : DEBUG : Output: “Mozilla Firefox 128.5.0esr”
20241210 14:54:02.704 : DEBUG : Detected browser: firefox 128.5.0
20241210 14:54:02.704 : WARN : Problem reading geckodriver versions: error sending request for url (https://raw.githubusercontent.com/SeleniumHQ/selenium/trunk/common/geckodriver/geckodriver-support.json). Using latest geckodriver version
20241210 14:54:02.704 : WARN : Exception managing firefox: error sending request for url (Release 0.35.0 · mozilla/geckodriver · GitHub)
20241210 14:54:02.705 : WARN : Error sending stats to Plausible: error sending request for url (https://plausible.io/api/event)
20241210 14:54:02.705 : DEBUG : Driver path: /usr/local/bin/geckodriver
20241210 14:54:02.705 : DEBUG : Browser path: /usr/bin/firefox
20241210 14:54:02.708 : DEBUG : Started executable: /usr/local/bin/geckodriver in a child process with pid: 7677 using 0 to output <_io.TextIOWrapper name=‘/tmp/RIDEuqpmxdlf.d/geckodriver-2.log’ mode=‘a+’ encoding=‘utf-8’>
20241210 14:54:02.723 : DEBUG : POST http://localhost:58179/session {‘capabilities’: {‘firstMatch’: [{}], ‘alwaysMatch’: {‘browserName’: ‘firefox’, ‘acceptInsecureCerts’: True, ‘moz:debuggerAddress’: True, ‘pageLoadStrategy’: <PageLoadStrategy.normal: ‘normal’>, ‘browserVersion’: None, ‘moz:firefoxOptions’: {‘binary’: ‘/usr/bin/firefox’, ‘prefs’: {‘remote.active-protocols’: 3}, ‘profile’: ‘UEsDBBQAAAAIAMF2ilnrmRmacgMAAJoMAAAHAAAAdXNlci5qc6VWTW/UMBC98ytQTyCx1rbABU6lFAkJUcSq4mg59mTjrmMbe7zp…’}}}}
20241210 14:54:02.723 : DEBUG : Starting new HTTP connection (1): localhost:58179
20241210 14:54:06.598 : DEBUG : http://localhost:58179 “POST /session HTTP/11” 200 0
20241210 14:54:06.599 : DEBUG : Remote response: status=200 | data={“value”:{“sessionId”:“d406502a-0a55-4c74-9468-ea11405d6e2e”,“capabilities”:{“acceptInsecureCerts”:true,“browserName”:“firefox”,“browserVersion”:“128.5.0”,“moz:accessibilityChecks”:false,“moz:buildID”:“20241118130310”,“moz:debuggerAddress”:“127.0.0.1:45434”,“moz:geckodriverVersion”:“0.35.0”,“moz:headless”:false,“moz:platformVersion”:“3.10.0-1160.123.1.el7.x86_64”,“moz:processID”:7684,“moz:profile”:“/tmp/rust_mozprofileZmsb78”,“moz:shutdownTimeout”:60000,“moz:webdriverClick”:true,“moz:windowless”:false,“pageLoadStrategy”:“normal”,“platformName”:“linux”,“proxy”:{},“setWindowRect”:true,“strictFileInteractability”:false,“timeouts”:{“implicit”:0,“pageLoad”:300000,“script”:30000},“unhandledPromptBehavior”:“dismiss and notify”,“userAgent”:“Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0”}}} | headers=HTTPHeaderDict({‘content-type’: ‘application/json; charset=utf-8’, ‘cache-control’: ‘no-cache’, ‘content-length’: ‘817’, ‘date’: ‘Tue, 10 Dec 2024 14:54:02 GMT’})
20241210 14:54:06.599 : DEBUG : Finished Request
20241210 14:54:06.599 : DEBUG : POST http://localhost:58179/session/d406502a-0a55-4c74-9468-ea11405d6e2e/timeouts {‘script’: 5000}
20241210 14:54:06.611 : DEBUG : http://localhost:58179 “POST /session/d406502a-0a55-4c74-9468-ea11405d6e2e/timeouts HTTP/11” 200 0
20241210 14:54:06.612 : DEBUG : Remote response: status=200 | data={“value”:null} | headers=HTTPHeaderDict({‘content-type’: ‘application/json; charset=utf-8’, ‘cache-control’: ‘no-cache’, ‘content-length’: ‘14’, ‘date’: ‘Tue, 10 Dec 2024 14:54:06 GMT’})
20241210 14:54:06.612 : DEBUG : Finished Request
20241210 14:54:06.612 : DEBUG : POST http://localhost:58179/session/d406502a-0a55-4c74-9468-ea11405d6e2e/timeouts {‘implicit’: 0}
20241210 14:54:06.615 : DEBUG : http://localhost:58179 “POST /session/d406502a-0a55-4c74-9468-ea11405d6e2e/timeouts HTTP/11” 200 0
20241210 14:54:06.616 : DEBUG : Remote response: status=200 | data={“value”:null} | headers=HTTPHeaderDict({‘content-type’: ‘application/json; charset=utf-8’, ‘cache-control’: ‘no-cache’, ‘content-length’: ‘14’, ‘date’: ‘Tue, 10 Dec 2024 14:54:06 GMT’})
20241210 14:54:06.616 : DEBUG : Finished Request
20241210 14:54:06.616 : DEBUG : POST http://localhost:58179/session/d406502a-0a55-4c74-9468-ea11405d6e2e/timeouts {‘pageLoad’: 300000}
20241210 14:54:06.618 : DEBUG : http://localhost:58179 “POST /session/d406502a-0a55-4c74-9468-ea11405d6e2e/timeouts HTTP/11” 200 0
20241210 14:54:06.618 : DEBUG : Remote response: status=200 | data={“value”:null} | headers=HTTPHeaderDict({‘content-type’: ‘application/json; charset=utf-8’, ‘cache-control’: ‘no-cache’, ‘content-length’: ‘14’, ‘date’: ‘Tue, 10 Dec 2024 14:54:06 GMT’})
20241210 14:54:06.618 : DEBUG : Finished Request
20241210 14:54:06.618 : DEBUG : POST http://localhost:58179/session/d406502a-0a55-4c74-9468-ea11405d6e2e/url {‘url’: ‘about:blank’}
20241210 14:54:06.670 : DEBUG : http://localhost:58179 “POST /session/d406502a-0a55-4c74-9468-ea11405d6e2e/url HTTP/11” 200 0
20241210 14:54:06.670 : DEBUG : Remote response: status=200 | data={“value”:null} | headers=HTTPHeaderDict({‘content-type’: ‘application/json; charset=utf-8’, ‘cache-control’: ‘no-cache’, ‘content-length’: ‘14’, ‘date’: ‘Tue, 10 Dec 2024 14:54:06 GMT’})
20241210 14:54:06.670 : DEBUG : Finished Request
20241210 14:54:06.670 : DEBUG : Opened browser with session id d406502a-0a55-4c74-9468-ea11405d6e2e.

There is an offline setting for Selenium Manager which can be triggered by an environment variable. See the “Configuration” section for more info. As it doesn’t have a method which can be attached to options or service Open Browser arguments, as far as I can see, you should be able to set it as an environment variable. This should stop the statistics reporting that Selenium Manager tries.

And in addition if you specify both the exectuable_path (or driver path) on the service argument and the binary_location (for the browser) on the options then selenium manager makes less of an attempt to find them and search out versions is there is a mismatch.

2 Likes

Hello Ed,

Thank u so, i put SE_OFFLINE=true in my env and it s ok

Thx again

Fabrice

2 Likes