Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[🐛 Bug]: Firefox and Edge Browser not launching on a Jenkins Linux Container #12495

Closed
jay14687se opened this issue Aug 4, 2023 · 44 comments
Labels

Comments

@jay14687se
Copy link

What happened?

When trying to run my test scripts on a Jenkins using Linux container for Firefox and Edge browsers I get he errors ad shown in the logs. This seems run fine on Local Windows machine.
Note: Also the container does not have Edge and Firefox pre installed.

How can we reproduce the issue?

Basic test to launch Firefox and Edge browser and launch a URL
this.browser = new EdgeDriver();
this.browser = new FirefoxDriver();

Relevant log output

Error while running the test:
Edge:
org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: unknown error: unrecognized Microsoft Edge version: Chrome/114.0.5735.90 
Host info: host: 'k8s-alm-pod-large-mem-oci-142hh', ip: '192.168.211.176'
Build info: version: '4.11.0', revision: '040bc5406b'
System info: os.name: 'Linux', os.arch: 'amd64', os.version: '4.14.35-2047.502.4.el7uek.x86_64', java.version: '17.0.5-ea'
Driver info: org.openqa.selenium.edge.EdgeDriver

Firefox:
org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 400. Message: binary is not a Firefox executable 
Host info: host: 'k8s-alm-pod-large-mem-oci-142hh', ip: '192.168.211.176'
Build info: version: '4.11.0', revision: '040bc5406b'
System info: os.name: 'Linux', os.arch: 'amd64', os.version: '4.14.35-2047.502.4.el7uek.x86_64', java.version: '17.0.5-ea'
Driver info: org.openqa.selenium.firefox.FirefoxDriver

Selenium Manager Output:
+ src/test/resources/drivers/chromedriver/linux/selenium-manager --browser firefox --debug
DEBUG	Checking geckodriver in PATH
DEBUG	Running command: geckodriver --version
DEBUG	Output: ""
DEBUG	geckodriver not found in PATH
DEBUG	Checking firefox in PATH
DEBUG	Running command: which firefox
DEBUG	Output: "/usr/local/firefox/firefox"
DEBUG	Found firefox in PATH: /usr/local/firefox/firefox
DEBUG	Using shell command to find out firefox version
DEBUG	Running command: /usr/local/firefox/firefox -v
DEBUG	Output: "Mozilla Firefox 113.0.2"
DEBUG	Detected browser: firefox 113.0.2
DEBUG	Required driver: geckodriver 0.33.0
DEBUG	Driver URL: https://github.com/mozilla/geckodriver/releases/download/v0.33.0/geckodriver-v0.33.0-linux64.tar.gz
INFO	Driver path: /home/jenkins/.cache/selenium/geckodriver/linux64/0.33.0/geckodriver
+ src/test/resources/drivers/chromedriver/linux/selenium-manager --browser edge --debug
DEBUG	Checking msedgedriver in PATH
DEBUG	Running command: msedgedriver --version
DEBUG	Output: ""
DEBUG	msedgedriver not found in PATH
DEBUG	Checking edge in PATH
DEBUG	Running command: which edge
DEBUG	Output: ""
DEBUG	edge not found in PATH
DEBUG	edge has not been discovered in the system
WARN	The version of edge cannot be detected. Trying with latest driver version
DEBUG	Reading msedgedriver latest version from https://msedgedriver.azureedge.net/LATEST_STABLE
DEBUG	Latest msedgedriver major version is 115
DEBUG	Reading msedgedriver version from https://msedgedriver.azureedge.net/LATEST_RELEASE_115_LINUX
DEBUG	Required driver: msedgedriver 115.0.1901.188
DEBUG	Driver URL: https://msedgedriver.azureedge.net/115.0.1901.188/edgedriver_linux64.zip
INFO	Driver path: /home/jenkins/.cache/selenium/msedgedriver/linux64/115.0.1901.188/msedgedriver

Operating System

Docker Linux

Selenium version

4.11.0

What are the browser(s) and version(s) where you see this issue?

Firefox 113.0.2, MS EDGE 115

What are the browser driver(s) and version(s) where you see this issue?

msedgedriver 115.0.1901.188, geckodriver 0.33.0

Are you using Selenium Grid?

no

@github-actions
Copy link

github-actions bot commented Aug 4, 2023

@jay14687se, thank you for creating this issue. We will troubleshoot it as soon as we can.


Info for maintainers

Triage this issue by using labels.

If information is missing, add a helpful comment and then I-issue-template label.

If the issue is a question, add the I-question label.

If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.

If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C), add the applicable G-* label, and it will provide the correct link and auto-close the issue.

After troubleshooting the issue, please add the R-awaiting answer label.

Thank you!

@titusfortner
Copy link
Member

Hmm, that output doesn't match what is in the most recent version, where is that binary coming from?

Can you turn on logging?
https://www.selenium.dev/documentation/webdriver/troubleshooting/logging/

I'm not a JS dev, but I think this works:

const logging = require('selenium-webdriver/lib/logging')
logging.installConsoleHandler()
logger = logging.getLogger('webdriver')
logger.setLevel(logging.Level.FINER)

@jay14687se
Copy link
Author

I have added Logging to my framework:

LoggingPreferences getWebDriverLoggingPreferences() {
		LoggingPreferences loggingPreferences = new LoggingPreferences();
		loggingPreferences.enable(LogType.BROWSER, Level.FINEST);
		return loggingPreferences;
	}

Are these the log details you are looking for?
Edge:

Command: [null, newSession {capabilities=[Capabilities {browserName: MicrosoftEdge, ms:edgeOptions: {args: [--remote-allow-origins=*, --disable-dev-shm-usage, --no-sandbox, --headless=new, --window-size=1920,1080], binary: , extensions: []}, ms:loggingPrefs: org.openqa.selenium.logging...}]}]
	at app//org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:140)
	at app//org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:96)
	at app//org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:68)
	at app//org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:163)
	at app//org.openqa.selenium.remote.service.DriverCommandExecutor.invokeExecute(DriverCommandExecutor.java:196)
	at app//org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:171)
	at app//org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:518)
	at app//org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:232)
	at app//org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:159)
	at app//org.openqa.selenium.chromium.ChromiumDriver.<init>(ChromiumDriver.java:108)
	at app//org.openqa.selenium.edge.EdgeDriver.<init>(EdgeDriver.java:60)
	at app//org.openqa.selenium.edge.EdgeDriver.<init>(EdgeDriver.java:56)
	at app//org.openqa.selenium.edge.EdgeDriver.<init>(EdgeDriver.java:48)
	at app//ocom.corelib.selenium.driver.SeleniumDriver.getBrowser(SeleniumDriver.java:119)
	at app//ui.basetest.SeleniumTest.initConfig(SeleniumTest.java:264)
	at app//ui.tests.AutoComplete.validateAutoComplete(AutoComplete.java:25)
	at [email protected]/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at [email protected]/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at [email protected]/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at [email protected]/java.lang.reflect.Method.invoke(Method.java:568)
	at app//org.testng.internal.invokers.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:139)
	at app//org.testng.internal.invokers.TestInvoker.invokeMethod(TestInvoker.java:664)
	at app//org.testng.internal.invokers.TestInvoker.invokeTestMethod(TestInvoker.java:227)
	at app//org.testng.internal.invokers.TestMethodWithDataProviderMethodWorker.call(TestMethodWithDataProviderMethodWorker.java:80)
	at app//org.testng.internal.invokers.TestMethodWithDataProviderMethodWorker.call(TestMethodWithDataProviderMethodWorker.java:17)
	at [email protected]/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at [email protected]/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
	at [email protected]/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at [email protected]/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at [email protected]/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at [email protected]/java.lang.Thread.run(Thread.java:833)

Firefox:

Command: [null, newSession {capabilities=[Capabilities {acceptInsecureCerts: true, browserName: firefox, moz:debuggerAddress: true, moz:firefoxOptions: {args: [--headless=new, --window-size=1920,1080], binary: }, moz:loggingPrefs: org.openqa.selenium.logging...}]}]
	at app//org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:140)
	at app//org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:96)
	at app//org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:68)
	at app//org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:163)
	at app//org.openqa.selenium.remote.service.DriverCommandExecutor.invokeExecute(DriverCommandExecutor.java:196)
	at app//org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:171)
	at app//org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:518)
	at app//org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:232)
	at app//org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:159)
	at app//org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:156)
	at app//org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:151)
	at app//org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:132)
	at app//org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:127)
	at app//org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:112)
	at app//ocom.corelib.selenium.driver.SeleniumDriver.getBrowser(SeleniumDriver.java:116)
	at app//ui.basetest.SeleniumTest.initConfig(SeleniumTest.java:264)
	at app//ui.tests.AutoComplete.validateAutoComplete(AutoComplete.java:25)
	at [email protected]/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at [email protected]/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at [email protected]/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at [email protected]/java.lang.reflect.Method.invoke(Method.java:568)
	at app//org.testng.internal.invokers.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:139)
	at app//org.testng.internal.invokers.TestInvoker.invokeMethod(TestInvoker.java:664)
	at app//org.testng.internal.invokers.TestInvoker.invokeTestMethod(TestInvoker.java:227)
	at app//org.testng.internal.invokers.TestMethodWithDataProviderMethodWorker.call(TestMethodWithDataProviderMethodWorker.java:80)
	at app//org.testng.internal.invokers.TestMethodWithDataProviderMethodWorker.call(TestMethodWithDataProviderMethodWorker.java:17)
	at [email protected]/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at [email protected]/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
	at [email protected]/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at [email protected]/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at [email protected]/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at [email protected]/java.lang.Thread.run(Thread.java:833)

@titusfortner
Copy link
Member

I want to see what the Selenium manager is doing, looks like the browser location is coming back empty or null.

@harsha509 do I have the logging code right? Should we be getting the Selenium manager logs from that?

@jay14687se
Copy link
Author

Selenium logs which I ran separately are provided in the "Relevant log output" section. If this not the same as what you are asking for please let me know what code do I need to add to get Selenium Manager logs.

@titusfortner
Copy link
Member

Maybe I need to stop replying to these by phone. Not sure why I thought this was JS (sorry @harsha509). Actually, yes I do, the location of Selenium Manager is wrong for Java.

I'm expecting to see a line in the logs with browser location. Since it isn't there it makes me think you are somehow using an old version of the SM binary, except I don't know how that's possible, so I wanted to see the full logs thinking something in there might shed light on things. Are you doing something with the manager?

@jay14687se
Copy link
Author

jay14687se commented Aug 5, 2023

I'm not invoking Selenium Manager anywhere inside my Java Selenium Testframework. I am just using the command new ChromeDriver() and let it do it's thing. I ran Selenium Manager executable separately by downloading it from the below link just to understand if the right driver is getting downloaded.
https://github.com/SeleniumHQ/selenium/blob/trunk/common/manager/linux/selenium-manager
I'm not seeing any logs in my test report or anywhere in the console related to Selenium Manager.

@titusfortner
Copy link
Member

Yes, so I want to see the logs from selenium manager when it is executing in your code, not from a separate download.

@jay14687se
Copy link
Author

Ok. So I don't know how to enable this in my code. Do you have some documentation on what I need to change in my Framework to get these logs?

@jay14687se
Copy link
Author

@titusfortner Is there a code/documentation that you can provide for me enable logs for Selenium Manager?

@titusfortner
Copy link
Member

#12495 (comment)

@jay14687se
Copy link
Author

@titusfortner I have already added this in my framework as mentioned in the above comment . But i don't see any Selenium Manager logs.

@titusfortner
Copy link
Member

Please read the link I provided for how to output logging for Selenium.

@jay14687se
Copy link
Author

@titusfortner Please find the logs for Edge and Firefox below. I have removed certificate logs and ip details since I'm running on company network, i hope that is ok.

Firefox:

Aug 08, 2023 11:52:46 PM org.openqa.selenium.manager.SeleniumManager getBinary
FINE: Selenium Manager binary found at: /tmp/selenium-manager109692599163000717640821002900972375/selenium-manager
Aug 08, 2023 11:52:46 PM org.openqa.selenium.manager.SeleniumManager runCommand
FINE: Executing Process: [/tmp/selenium-manager109692599163000717640821002900972375/selenium-manager, --browser, firefox, --output, json, --debug]
Aug 08, 2023 11:52:47 PM org.openqa.selenium.manager.SeleniumManager lambda$runCommand$1
FINE: Checking geckodriver in PATH
Aug 08, 2023 11:52:47 PM org.openqa.selenium.manager.SeleniumManager lambda$runCommand$1
FINE: Running command: geckodriver --version
Aug 08, 2023 11:52:47 PM org.openqa.selenium.manager.SeleniumManager lambda$runCommand$1
FINE: Output: ""
Aug 08, 2023 11:52:47 PM org.openqa.selenium.manager.SeleniumManager lambda$runCommand$1
FINE: geckodriver not found in PATH
Aug 08, 2023 11:52:47 PM org.openqa.selenium.manager.SeleniumManager lambda$runCommand$1
FINE: Checking firefox in PATH
Aug 08, 2023 11:52:47 PM org.openqa.selenium.manager.SeleniumManager lambda$runCommand$1
FINE: Running command: which firefox
Aug 08, 2023 11:52:47 PM org.openqa.selenium.manager.SeleniumManager lambda$runCommand$1
FINE: Output: "/usr/local/firefox/firefox"
Aug 08, 2023 11:52:47 PM org.openqa.selenium.manager.SeleniumManager lambda$runCommand$1
FINE: Found firefox in PATH: /usr/local/firefox/firefox
Aug 08, 2023 11:52:47 PM org.openqa.selenium.manager.SeleniumManager lambda$runCommand$1
FINE: Using shell command to find out firefox version
Aug 08, 2023 11:52:47 PM org.openqa.selenium.manager.SeleniumManager lambda$runCommand$1
FINE: Running command: /usr/local/firefox/firefox -v
Aug 08, 2023 11:52:47 PM org.openqa.selenium.manager.SeleniumManager lambda$runCommand$1
FINE: Output: "Mozilla Firefox 113.0.2"
Aug 08, 2023 11:52:47 PM org.openqa.selenium.manager.SeleniumManager lambda$runCommand$1
FINE: Detected browser: firefox 113.0.2
Aug 08, 2023 11:52:47 PM org.openqa.selenium.manager.SeleniumManager lambda$runCommand$1
FINE: Required driver: geckodriver 0.33.0
Aug 08, 2023 11:52:47 PM org.openqa.selenium.manager.SeleniumManager lambda$runCommand$1
FINE: Driver URL: https://github.com/mozilla/geckodriver/releases/download/v0.33.0/geckodriver-v0.33.0-linux64.tar.gz
Aug 08, 2023 11:52:47 PM org.openqa.selenium.manager.SeleniumManager lambda$runCommand$1
FINE: Driver path: /home/jenkins/.cache/selenium/geckodriver/linux64/0.33.0/geckodriver
Aug 08, 2023 11:52:47 PM org.openqa.selenium.manager.SeleniumManager getDriverPath
FINE: Using driver at location: /home/jenkins/.cache/selenium/geckodriver/linux64/0.33.0/geckodriver, browser at location 
Aug 08, 2023 11:52:48 PM jdk.internal.event.EventHelper logX509CertificateEvent
<Removed Certificate logs>
Aug 08, 2023 11:52:48 PM org.openqa.selenium.remote.RemoteWebDriver log
FINE: Executing: newSession [null, newSession {capabilities=[Capabilities {acceptInsecureCerts: true, browserName: firefox, moz:debuggerAddress: true, moz:firefoxOptions: {args: [--headless=new, --window-size=1920,1080], binary: }, moz:loggingPrefs: org.openqa.selenium.logging...}]}]
Aug 08, 2023 11:52:48 PM org.openqa.selenium.remote.service.DriverService start
FINE: Starting driver at /home/jenkins/.cache/selenium/geckodriver/linux64/0.33.0/geckodriver with [--port=<port>, --websocket-port=<port>, --allow-origins]
Aug 08, 2023 11:52:48 PM org.openqa.selenium.remote.RemoteWebDriver log
FINE: Exception: newSession Could not start a new session. Response code 400. Message: binary is not a Firefox executable 
Host info: host: 'k8s-alm-pod-large-mem-oci-lx5lh', ip: '<ip>'
Build info: version: '4.11.0', revision: '040bc5406b'
System info: os.name: 'Linux', os.arch: 'amd64', os.version: '4.14.35-2047.521.4.el7uek.x86_64', java.version: '17.0.5-ea'

Edge:

Aug 09, 2023 6:23:37 AM org.openqa.selenium.manager.SeleniumManager getBinary
FINE: Selenium Manager binary found at: /tmp/selenium-manager118396385931916089713517283732309408/selenium-manager
Aug 09, 2023 6:23:37 AM org.openqa.selenium.manager.SeleniumManager runCommand
FINE: Executing Process: [/tmp/selenium-manager118396385931916089713517283732309408/selenium-manager, --browser, MicrosoftEdge, --output, json, --debug]
Aug 09, 2023 6:23:41 AM org.openqa.selenium.manager.SeleniumManager lambda$runCommand$1
FINE: Checking msedgedriver in PATH
Aug 09, 2023 6:23:41 AM org.openqa.selenium.manager.SeleniumManager lambda$runCommand$1
FINE: Running command: msedgedriver --version
Aug 09, 2023 6:23:41 AM org.openqa.selenium.manager.SeleniumManager lambda$runCommand$1
FINE: Output: ""
Aug 09, 2023 6:23:41 AM org.openqa.selenium.manager.SeleniumManager lambda$runCommand$1
FINE: msedgedriver not found in PATH
Aug 09, 2023 6:23:41 AM org.openqa.selenium.manager.SeleniumManager lambda$runCommand$1
FINE: Checking edge in PATH
Aug 09, 2023 6:23:41 AM org.openqa.selenium.manager.SeleniumManager lambda$runCommand$1
FINE: Running command: which edge
Aug 09, 2023 6:23:41 AM org.openqa.selenium.manager.SeleniumManager lambda$runCommand$1
FINE: Output: ""
Aug 09, 2023 6:23:41 AM org.openqa.selenium.manager.SeleniumManager lambda$runCommand$1
FINE: edge not found in PATH
Aug 09, 2023 6:23:41 AM org.openqa.selenium.manager.SeleniumManager lambda$runCommand$1
FINE: edge has not been discovered in the system
Aug 09, 2023 6:23:41 AM org.openqa.selenium.manager.SeleniumManager lambda$runCommand$1
WARNING: The version of edge cannot be detected. Trying with latest driver version
Aug 09, 2023 6:23:41 AM org.openqa.selenium.manager.SeleniumManager lambda$runCommand$1
FINE: Reading msedgedriver latest version from https://msedgedriver.azureedge.net/LATEST_STABLE
Aug 09, 2023 6:23:41 AM org.openqa.selenium.manager.SeleniumManager lambda$runCommand$1
FINE: Latest msedgedriver major version is 115
Aug 09, 2023 6:23:41 AM org.openqa.selenium.manager.SeleniumManager lambda$runCommand$1
FINE: Reading msedgedriver version from https://msedgedriver.azureedge.net/LATEST_RELEASE_115_LINUX
Aug 09, 2023 6:23:41 AM org.openqa.selenium.manager.SeleniumManager lambda$runCommand$1
FINE: Required driver: msedgedriver 115.0.1901.200
Aug 09, 2023 6:23:41 AM org.openqa.selenium.manager.SeleniumManager lambda$runCommand$1
FINE: Driver URL: https://msedgedriver.azureedge.net/115.0.1901.200/edgedriver_linux64.zip
Aug 09, 2023 6:23:41 AM org.openqa.selenium.manager.SeleniumManager lambda$runCommand$1
FINE: Driver path: /home/jenkins/.cache/selenium/msedgedriver/linux64/115.0.1901.200/msedgedriver
Aug 09, 2023 6:23:41 AM org.openqa.selenium.manager.SeleniumManager getDriverPath
FINE: Using driver at location: /home/jenkins/.cache/selenium/msedgedriver/linux64/115.0.1901.200/msedgedriver, browser at location 
Aug 09, 2023 6:23:41 AM jdk.internal.event.EventHelper logX509CertificateEvent
<Removed Certificate Logs>
Aug 09, 2023 6:23:42 AM org.openqa.selenium.remote.RemoteWebDriver log
FINE: Executing: newSession [null, newSession {capabilities=[Capabilities {browserName: MicrosoftEdge, ms:edgeOptions: {args: [--remote-allow-origins=*, --disable-dev-shm-usage, --no-sandbox, --headless=new, --window-size=1920,1080], binary: , extensions: []}, ms:loggingPrefs: org.openqa.selenium.logging...}]}]
Aug 09, 2023 6:23:42 AM org.openqa.selenium.remote.service.DriverService start
FINE: Starting driver at /home/jenkins/.cache/selenium/msedgedriver/linux64/115.0.1901.200/msedgedriver with [--port=<port>]
Aug 09, 2023 6:23:42 AM org.openqa.selenium.net.UrlChecker waitUntilAvailable
FINE: Waiting for [http://localhost:<port>/status]
Aug 09, 2023 6:23:42 AM org.openqa.selenium.net.UrlChecker lambda$waitUntilAvailable$1
FINE: Polling http://localhost:<port>/status
Aug 09, 2023 6:23:42 AM sun.net.www.protocol.http.HttpURLConnection writeRequests
FINE: sun.net.www.MessageHeader@6ad889385 pairs: {GET /status HTTP/1.1: null}{User-Agent: Java/17.0.5-ea}{Host: localhost:12220}{Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2}{Connection: keep-alive}
Aug 09, 2023 6:23:42 AM sun.net.www.protocol.http.HttpURLConnection getInputStream0
FINE: sun.net.www.MessageHeader@41a6a66b4 pairs: {null: HTTP/1.1 200 OK}{Content-Length: 237}{Content-Type: application/json; charset=utf-8}{cache-control: no-cache}
Aug 09, 2023 6:24:42 AM org.openqa.selenium.net.UrlChecker waitUntilUnavailable
FINE: Waiting for http://localhost:<port>/shutdown
Aug 09, 2023 6:24:42 AM org.openqa.selenium.net.UrlChecker lambda$waitUntilUnavailable$2
FINE: Polling http://localhost:<port>/shutdown
Aug 09, 2023 6:24:42 AM sun.net.www.protocol.http.HttpURLConnection writeRequests
FINE: sun.net.www.MessageHeader@d085a695 pairs: {GET /shutdown HTTP/1.1: null}{User-Agent: Java/17.0.5-ea}{Host: localhost:12220}{Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2}{Connection: keep-alive}
Aug 09, 2023 6:24:42 AM sun.net.www.protocol.http.HttpURLConnection getInputStream0
FINE: sun.net.www.MessageHeader@3cfa5b83 pairs: {null: HTTP/1.1 200 OK}{Content-Length: 40}{Content-Type: application/json; charset=utf-8}
Aug 09, 2023 6:24:42 AM org.openqa.selenium.net.UrlChecker lambda$waitUntilUnavailable$2
FINE: Polling http://localhost:<port>/shutdown
Aug 09, 2023 6:24:42 AM org.openqa.selenium.remote.RemoteWebDriver log
FINE: Exception: newSession Could not start a new session. Response code 500. Message: unknown error: unrecognized Microsoft Edge version: Chrome/114.0.5735.90 
Host info: host: 'k8s-alm-pod-large-mem-oci-3tlpf', ip: '<ip>'
Build info: version: '4.11.0', revision: '040bc5406b'
System info: os.name: 'Linux', os.arch: 'amd64', os.version: '5.4.17-2102.205.7.3.el7uek.x86_64', java.version: '17.0.5-ea'
Driver info: driver.version: SeleniumDriver

@titusfortner
Copy link
Member

If you have Edge installed, it isn't where Selenium knows to look for it, so you need to specify the location in the Edge Options class.

Firefox is more confusing. It finds it, gets the version, but for some reason isn't including it in the return JSON. @bonigarcia any idea how this could use the location and then lose it before reporting it?

@jay14687se
Copy link
Author

Edge is not installed on the container. It only has Chrome and Firefox.

@titusfortner
Copy link
Member

titusfortner commented Aug 9, 2023

Selenium does not yet automatically download Edge, you have to install it yourself to use it. Firefox situation is unusual though.

@jay14687se
Copy link
Author

jay14687se commented Aug 9, 2023

Oh ok. So i will try to setup edge. But how is Edge picking the Chrome Browser - Chrome/114.0.5735.90?

@bonigarcia
Copy link
Member

Selenium Manager is behaving correctly with Edge (since it is not installed). But I don't know where this version (Chrome/114.0.5735.90) comes from.

Regarding Firefox, I have confirmed it is a bug in Selenium Manager. I have just committed a patch to solve it: fb40ce3

@jay14687se This fix will be available in Selenium 4.12.0. As a temporary workaround in your test, you can try to set your Firefox binary path. It should do the trick:

FirefoxOptions options = new FirefoxOptions();
options.setBinary("/usr/local/firefox/firefox");
this.browser = new FirefoxDriver(options);

@jay14687se
Copy link
Author

@bonigarcia Thanks. Not sure what is happening with Edge. For firefox i will try the temporary workaround for now.

@RaviNelluri
Copy link

@jay14687se are you able to run the FF in selenoid container . When I am running I am getting

"org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 400. Message: Unrecognised option moz:debuggerAddress "

I added options.setBinary("/usr/local/firefox/firefox"); but still I am getting same error . If you are able to lanuch FF then let me know

@jay14687se
Copy link
Author

@RaviNelluri This is a bug. Please refer to comment

@Argano-GQE
Copy link

Today, I checked with 4.12.0 selenium-java version but still I am getting same error

@Argano-GQE
Copy link

Selenium Manager is behaving correctly with Edge (since it is not installed). But I don't know where this version (Chrome/114.0.5735.90) comes from.

Regarding Firefox, I have confirmed it is a bug in Selenium Manager. I have just committed a patch to solve it: fb40ce3

@jay14687se This fix will be available in Selenium 4.12.0. As a temporary workaround in your test, you can try to set your Firefox binary path. It should do the trick:

FirefoxOptions options = new FirefoxOptions();
options.setBinary("/usr/local/firefox/firefox");
this.browser = new FirefoxDriver(options);

Still getting the error with 4.12.0

@bonigarcia
Copy link
Member

The following problem:

Response code 500. Message: unknown error: unrecognized Microsoft Edge version: Chrome/114.0.5735.90 

... is an open issue in Microsoft Edge Driver on Linux, see MicrosoftEdge/EdgeWebDriver#102

@Argano-GQE
Copy link

Still have a problem with FF browser also.

@bonigarcia
Copy link
Member

In Firefox, I don't know the cause of this problem:

org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 400. Message: Unrecognised option moz:debuggerAddress

It seems beyond Selenium Manager. Maybe geckodriver?

@diemol @titusfortner Any idea?

@diemol
Copy link
Member

diemol commented Sep 4, 2023

@Argano-GQE that error comes from the remote end. You need to report that to the Selenoid project.

@diemol
Copy link
Member

diemol commented Sep 4, 2023

@jay14687se Regarding your Firefox error, we would like the complete logs and a piece of code that shows how you are creating the session request. If it works in Windows but not Linux, I don't discard some conditionals in your code based on the platform.

@fvue
Copy link

fvue commented Oct 3, 2023

I found the regression to be in selenium-webdriver-4.12.0. With 4.11.0, firefox starts all right.

Starting from selenium-webdriver-4.12.0 (up to and including 4.13.1), I get this log output (error "binary is not a Firefox executable"):

2023-10-03 12:50:28 DEBUG Selenium [:selenium_manager] Selenium Manager binary found at /home/usr2/.rvm/gems/ruby-3.1.4@travelsim/gems/selenium-webdriver-4.12.0/bin/linux/selenium-manager
2023-10-03 12:50:28 DEBUG Selenium [:selenium_manager] Executing Process ["/home/usr2/.rvm/gems/ruby-3.1.4@travelsim/gems/selenium-webdriver-4.12.0/bin/linux/selenium-manager", "--browser", "firefox", "--output", "json", "--debug"]
2023-10-03 12:50:28 DEBUG Selenium [:selenium_manager] Found geckodriver 0.33.0 in PATH: /snap/bin/geckodriver
2023-10-03 12:50:28 DEBUG Selenium [:selenium_manager] Found firefox in PATH: /usr/bin/snap
2023-10-03 12:50:28 DEBUG Selenium [:selenium_manager] Running command: /usr/bin/snap -v
2023-10-03 12:50:28 DEBUG Selenium [:selenium_manager] Output: ""
2023-10-03 12:50:28 DEBUG Selenium [:selenium_manager] Running command: "/snap/bin/firefox" -v
2023-10-03 12:50:28 DEBUG Selenium [:selenium_manager] Output: "Mozilla Firefox 118.0.1"
2023-10-03 12:50:28 DEBUG Selenium [:selenium_manager] Detected browser: firefox 118.0.1
2023-10-03 12:50:28 DEBUG Selenium [:selenium_manager] Required driver: geckodriver 0.33.0
2023-10-03 12:50:28 DEBUG Selenium [:selenium_manager] Driver path: /snap/bin/geckodriver
2023-10-03 12:50:28 DEBUG Selenium [:selenium_manager] Browser path: /usr/bin/snap
2023-10-03 12:50:28 DEBUG Selenium [:driver_service] Executing Process ["/snap/bin/geckodriver", "--port=4444"]
2023-10-03 12:50:28 DEBUG Selenium [:process] Starting process: ["/snap/bin/geckodriver", "--port=4444"] with {[:out, :err]=>#<IO:<STDOUT>>, :pgroup=>true}
2023-10-03 12:50:28 DEBUG Selenium [:process]   -> pid: 67977
2023-10-03 12:50:28 DEBUG Selenium [:driver_service] polling for socket on ["127.0.0.1", 4444]
2023-10-03 12:50:28 DEBUG Selenium [:driver_service] polling for socket on ["127.0.0.1", 4444]
1696330228860   geckodriver     INFO    Listening on 127.0.0.1:4444
2023-10-03 12:50:29 DEBUG Selenium [:command] -> POST session
2023-10-03 12:50:29 DEBUG Selenium [:command]    >>> http://127.0.0.1:4444/session | {"capabilities":{"alwaysMatch":{"acceptInsecureCerts":true,"browserName":"firefox","moz:firefoxOptions":{"binary":"/usr/bin/snap"},"moz:debuggerAddress":true}}}
2023-10-03 12:50:29 DEBUG Selenium [:header]      > {"Accept"=>"application/json", "Content-Type"=>"application/json; charset=UTF-8", "User-Agent"=>"selenium/4.12.0 (ruby linux)", "Content-Length"=>"160"}
2023-10-03 12:50:29 DEBUG Selenium [:header]    <<<  {"content-type"=>["application/json; charset=utf-8"], "cache-control"=>["no-cache"], "content-length"=>["101"], "date"=>["Tue, 03 Oct 2023 10:50:29 GMT"]}
2023-10-03 12:50:29 DEBUG Selenium [:command] <- {"value":{"error":"invalid argument","message":"binary is not a Firefox executable","stacktrace":""}}
2023-10-03 12:50:29 DEBUG Selenium [:selenium_manager] Executing Process ["/home/usr2/.rvm/gems/ruby-3.1.4@travelsim/gems/selenium-webdriver-4.12.0/bin/linux/selenium-manager", "--browser", "firefox", "--browser-path", "/usr/bin/snap", "--output", "json", "--debug"]
2023-10-03 12:50:29 DEBUG Selenium [:selenium_manager] Found geckodriver 0.33.0 in PATH: /snap/bin/geckodriver
2023-10-03 12:50:29 DEBUG Selenium [:selenium_manager] Running command: /usr/bin/snap -v
2023-10-03 12:50:29 DEBUG Selenium [:selenium_manager] Output: ""
2023-10-03 12:50:29 DEBUG Selenium [:selenium_manager] Running command: "/usr/bin/snap" -v
2023-10-03 12:50:29 DEBUG Selenium [:selenium_manager] Output: ""
2023-10-03 12:50:29 DEBUG Selenium [:selenium_manager] Running command: '/usr/bin/snap' -v
2023-10-03 12:50:29 DEBUG Selenium [:selenium_manager] Output: ""
2023-10-03 12:50:29 DEBUG Selenium [:selenium_manager] Running command: /usr/bin/snap -v
2023-10-03 12:50:29 DEBUG Selenium [:selenium_manager] Output: ""
2023-10-03 12:50:29 DEBUG Selenium [:selenium_manager] firefox not found in the system
2023-10-03 12:50:29 DEBUG Selenium [:selenium_manager] Required browser: firefox 118.0.1
2023-10-03 12:50:29 DEBUG Selenium [:selenium_manager] firefox 118.0.1 already in the cache
2023-10-03 12:50:29 DEBUG Selenium [:selenium_manager] firefox 118.0.1 has been downloaded at /home/usr2/.cache/selenium/firefox/linux64/118.0.1/firefox
2023-10-03 12:50:29 DEBUG Selenium [:selenium_manager] Required driver: geckodriver 0.33.0
2023-10-03 12:50:29 DEBUG Selenium [:selenium_manager] Driver path: /snap/bin/geckodriver
2023-10-03 12:50:29 DEBUG Selenium [:selenium_manager] Browser path: /home/usr2/.cache/selenium/firefox/linux64/118.0.1/firefox
2023-10-03 12:50:29 DEBUG Selenium [:driver_service] Executing Process ["/snap/bin/geckodriver", "--port=4446"]
2023-10-03 12:50:29 DEBUG Selenium [:process] Starting process: ["/snap/bin/geckodriver", "--port=4446"] with {[:out, :err]=>#<IO:<STDOUT>>, :pgroup=>true}
2023-10-03 12:50:29 DEBUG Selenium [:process]   -> pid: 68190
2023-10-03 12:50:29 DEBUG Selenium [:driver_service] polling for socket on ["127.0.0.1", 4446]
1696330229626   geckodriver     INFO    Listening on 127.0.0.1:4446
2023-10-03 12:50:29 DEBUG Selenium [:command] -> POST session
2023-10-03 12:50:29 DEBUG Selenium [:command]    >>> http://127.0.0.1:4446/session | {"capabilities":{"alwaysMatch":{"acceptInsecureCerts":true,"browserName":"firefox","moz:firefoxOptions":{"binary":"/home/usr2/.cache/selenium/firefox/linux64/118.0.1/firefox"},"moz:de
buggerAddress":true}}}
2023-10-03 12:50:29 DEBUG Selenium [:header]      > {"Accept"=>"application/json", "Content-Type"=>"application/json; charset=UTF-8", "User-Agent"=>"selenium/4.12.0 (ruby linux)", "Content-Length"=>"207"}
2023-10-03 12:50:29 DEBUG Selenium [:header]    <<<  {"content-type"=>["application/json; charset=utf-8"], "cache-control"=>["no-cache"], "content-length"=>["101"], "date"=>["Tue, 03 Oct 2023 10:50:29 GMT"]}
2023-10-03 12:50:29 DEBUG Selenium [:command] <- {"value":{"error":"invalid argument","message":"binary is not a Firefox executable","stacktrace":""}}

Whereas, with selenium-webdriver-4.11.0, I get this log output (no error):

2023-10-03 12:53:53 DEBUG Selenium [:selenium_manager] Selenium Manager binary found at /home/usr2/.rvm/gems/ruby-3.1.4@travelsim/gems/selenium-webdriver-4.11.0/bin/linux/selenium-manager
2023-10-03 12:53:53 DEBUG Selenium [:selenium_manager] Executing Process ["/home/usr2/.rvm/gems/ruby-3.1.4@travelsim/gems/selenium-webdriver-4.11.0/bin/linux/selenium-manager", "--browser", "firefox", "--output", "json", "--debug"]
2023-10-03 12:53:54 DEBUG Selenium [:selenium_manager] Checking geckodriver in PATH
2023-10-03 12:53:54 DEBUG Selenium [:selenium_manager] Running command: geckodriver --version
2023-10-03 12:53:54 DEBUG Selenium [:selenium_manager] Output: "geckodriver 0.33.0 ( 2023-09-28)\n\nThe source code of this program is available from\ntesting/geckodriver in https://hg.mozilla.org/mozilla-central.\n\nThis program is subject to the terms of the Mozilla P
ublic License 2.0.\nYou can obtain a copy of the license at https://mozilla.org/MPL/2.0/."
2023-10-03 12:53:54 DEBUG Selenium [:selenium_manager] Running command: which geckodriver
2023-10-03 12:53:54 DEBUG Selenium [:selenium_manager] Output: "/snap/bin/geckodriver"
2023-10-03 12:53:54 DEBUG Selenium [:selenium_manager] Found geckodriver 0.33.0 in PATH: /snap/bin/geckodriver
2023-10-03 12:53:54 DEBUG Selenium [:selenium_manager] Checking firefox in PATH
2023-10-03 12:53:54 DEBUG Selenium [:selenium_manager] Running command: which firefox
2023-10-03 12:53:54 DEBUG Selenium [:selenium_manager] Output: "/snap/bin/firefox"
2023-10-03 12:53:54 DEBUG Selenium [:selenium_manager] Found firefox in PATH: /snap/bin/firefox
2023-10-03 12:53:54 DEBUG Selenium [:selenium_manager] Using shell command to find out firefox version
2023-10-03 12:53:54 DEBUG Selenium [:selenium_manager] Running command: /usr/bin/snap -v
2023-10-03 12:53:54 DEBUG Selenium [:selenium_manager] Output: ""
2023-10-03 12:53:54 DEBUG Selenium [:selenium_manager] Running command: "/snap/bin/firefox" -v
2023-10-03 12:53:54 DEBUG Selenium [:selenium_manager] Output: "Mozilla Firefox 118.0.1"
2023-10-03 12:53:54 DEBUG Selenium [:selenium_manager] Detected browser: firefox 118.0.1
2023-10-03 12:53:54 DEBUG Selenium [:selenium_manager] Required driver: geckodriver 0.33.0
2023-10-03 12:53:54 DEBUG Selenium [:selenium_manager] Driver path: /snap/bin/geckodriver
2023-10-03 12:53:54 DEBUG Selenium [:driver_service] Executing Process ["/snap/bin/geckodriver", "--port=4444"]
2023-10-03 12:53:54 DEBUG Selenium [:process] Starting process: ["/snap/bin/geckodriver", "--port=4444"] with {[:out, :err]=>#<IO:<STDOUT>>, :pgroup=>true}
2023-10-03 12:53:54 DEBUG Selenium [:process]   -> pid: 68688
2023-10-03 12:53:54 DEBUG Selenium [:driver_service] polling for socket on ["127.0.0.1", 4444]
1696330435087   geckodriver     INFO    Listening on 127.0.0.1:4444
2023-10-03 12:53:55 DEBUG Selenium [:command] -> POST session
2023-10-03 12:53:55 DEBUG Selenium [:command]    >>> http://127.0.0.1:4444/session | {"capabilities":{"alwaysMatch":{"acceptInsecureCerts":true,"browserName":"firefox","moz:firefoxOptions":{},"moz:debuggerAddress":true}}}
2023-10-03 12:53:55 DEBUG Selenium [:header]      > {"Accept"=>"application/json", "Content-Type"=>"application/json; charset=UTF-8", "User-Agent"=>"selenium/4.11.0 (ruby linux)", "Content-Length"=>"136"}
1696330435281   mozrunner::runner       INFO    Running command: "/snap/firefox/current/firefox.launcher" "--marionette" "--remote-debugging-port" "9222" "--remote-allow-hosts" "localhost" "-no-remote" "-profile" "/tmp/rust_mozprofilevSUdz2"

@titusfortner
Copy link
Member

It started failing because Selenium is now helpfully managing Firefox browser and driver for you, but snap makes the job difficult.

@bonigarcia why is it using /usr/bin/snap instead of /snap/bin/firefox?

@bonigarcia
Copy link
Member

There are a couple of things I don't understand. It may be a bug in Selenium Manager, but I need to ensure it.

First, Selenium Manager seems to fail to detect Firefox in a path in version 4.12+ but not in 4.11:

Found firefox in PATH: /usr/bin/snap

@fvue Can you please run the following commands in the shell and share the output here?

which firefox
ls -la /snap/bin/firefox

Then, when Firefox in the path is not detected, it is downloaded by Selenium Manager. But it seems the resulting binary is not correct for some reason. Can you please check the following:

ls -la /home/usr2/.cache/selenium/firefox/linux64/118.0.1

@fvue
Copy link

fvue commented Oct 3, 2023

$ which firefox
/snap/bin/firefox

$ ls -la /snap/bin/firefox
lrwxrwxrwx 1 root root 13 sep 28 22:58 /snap/bin/firefox -> /usr/bin/snap

$ ls -la /home/usr2/.cache/selenium/firefox/linux64/118.0.1
total 191184
drwxrwxr-x 7 usr2 users      4096 okt  2 17:18 .
drwxrwxr-x 3 usr2 users      4096 okt  2 17:18 ..
-rw-r--r-- 1 usr2 users       899 jan  1  1970 application.ini
drwxrwxr-x 4 usr2 users      4096 okt  2 17:18 browser
-rwxr-xr-x 1 usr2 users    269976 jan  1  1970 crashreporter
-rw-r--r-- 1 usr2 users      3902 jan  1  1970 crashreporter.ini
drwxrwxr-x 3 usr2 users      4096 okt  2 17:18 defaults
-rw-r--r-- 1 usr2 users       189 jan  1  1970 dependentlibs.list
-rwxr-xr-x 1 usr2 users     14352 jan  1  1970 firefox
-rwxr-xr-x 1 usr2 users    761184 jan  1  1970 firefox-bin
-rw-r--r-- 1 usr2 users      1449 jan  1  1970 firefox-bin.sig
-rw-r--r-- 1 usr2 users      1449 jan  1  1970 firefox.sig
drwxrwxr-x 2 usr2 users      4096 okt  2 17:18 fonts
-rwxr-xr-x 1 usr2 users     31264 jan  1  1970 glxtest
drwxrwxr-x 3 usr2 users      4096 okt  2 17:18 gmp-clearkey
drwxrwxr-x 2 usr2 users      4096 okt  2 17:18 icons
-rwxr-xr-x 1 usr2 users    915792 jan  1  1970 libfreeblpriv3.so
-rwxr-xr-x 1 usr2 users    518336 jan  1  1970 libgkcodecs.so
-rwxr-xr-x 1 usr2 users    380096 jan  1  1970 libipcclientcerts.so
-rwxr-xr-x 1 usr2 users     43136 jan  1  1970 liblgpllibs.so
-rwxr-xr-x 1 usr2 users   3780472 jan  1  1970 libmozavcodec.so
-rwxr-xr-x 1 usr2 users    240392 jan  1  1970 libmozavutil.so
-rwxr-xr-x 1 usr2 users     14072 jan  1  1970 libmozgtk.so
-rwxr-xr-x 1 usr2 users    129616 jan  1  1970 libmozsandbox.so
-rwxr-xr-x 1 usr2 users   1232456 jan  1  1970 libmozsqlite3.so
-rwxr-xr-x 1 usr2 users     18160 jan  1  1970 libmozwayland.so
-rwxr-xr-x 1 usr2 users    222880 jan  1  1970 libnspr4.so
-rwxr-xr-x 1 usr2 users    772504 jan  1  1970 libnss3.so
-rwxr-xr-x 1 usr2 users    547832 jan  1  1970 libnssckbi.so
-rwxr-xr-x 1 usr2 users    191448 jan  1  1970 libnssutil3.so
-rwxr-xr-x 1 usr2 users     22592 jan  1  1970 libplc4.so
-rwxr-xr-x 1 usr2 users     14312 jan  1  1970 libplds4.so
-rwxr-xr-x 1 usr2 users    171584 jan  1  1970 libsmime3.so
-rwxr-xr-x 1 usr2 users    366968 jan  1  1970 libsoftokn3.so
-rwxr-xr-x 1 usr2 users    451144 jan  1  1970 libssl3.so
-rwxr-xr-x 1 usr2 users 148399856 jan  1  1970 libxul.so
-rw-r--r-- 1 usr2 users      1449 jan  1  1970 libxul.so.sig
-rwxr-xr-x 1 usr2 users   1739328 jan  1  1970 minidump-analyzer
-rw-r--r-- 1 usr2 users  32704994 jan  1  1970 omni.ja
-rwxr-xr-x 1 usr2 users    814464 jan  1  1970 pingsender
-rw-r--r-- 1 usr2 users       167 jan  1  1970 platform.ini
-rwxr-xr-x 1 usr2 users    757024 jan  1  1970 plugin-container
-rw-r--r-- 1 usr2 users      1449 jan  1  1970 plugin-container.sig
-rw-r--r-- 1 usr2 users      2020 jan  1  1970 precomplete
-rw-r--r-- 1 usr2 users         0 jan  1  1970 removed-files
-rw-r--r-- 1 usr2 users       825 jan  1  1970 Throbber-small.gif
-rwxr-xr-x 1 usr2 users     97512 jan  1  1970 updater
-rw-r--r-- 1 usr2 users       638 jan  1  1970 updater.ini
-rw-r--r-- 1 usr2 users       132 jan  1  1970 update-settings.ini
-rwxr-xr-x 1 usr2 users     22912 jan  1  1970 vaapitest

@bonigarcia
Copy link
Member

Thanks a lot, @fvue.

It seems the problem is that Selenium Manager is resolving the symbolic link from /snap/bin/firefox to /usr/bin/snap. But then, /usr/bin/snap does not behave as expected since the Firefox version cannot be detected as usual. I confirmed it in a Linux machine:

user@ubuntu-vm:~/dev/selenium/rust$ which firefox
/snap/bin/firefox
user@ubuntu-vm:~/dev/selenium/rust$ ls -la /snap/bin/firefox
lrwxrwxrwx 1 root root 13 sep 29 12:28 /snap/bin/firefox -> /usr/bin/snap
user@ubuntu-vm:~/dev/selenium/rust$ /snap/bin/firefox -v
Mozilla Firefox 118.0.1
user@ubuntu-vm:~/dev/selenium/rust$ /usr/bin/snap -v
error: unknown flag `v'

So, I will change the Selenium Manager to avoid resolving the symbolic link for browsers found in the PATH. It will be available in the next Selenium version.

Regarding the second part, Firefox has been correctly downloaded by Selenium Manager, and it is executable:

$ ls -la /home/usr2/.cache/selenium/firefox/linux64/118.0.1
...
-rwxr-xr-x 1 usr2 users     14352 jan  1  1970 firefox

So the problem must be the relationship between the driver and browser, since the resolved driver is for snap, but the browser is the regular one. To solve it, you can try to remove geckodriver from your path (/snap/bin/geckodriver), or wait for the next Selenium version.

@titusfortner
Copy link
Member

So this is an issue of whether to use snap at all or not, right?

For snap you need the snap browser + the snap driver.
If the browser is on path, it will be grabbed, but then we need to make sure that the appropriate geckodriver is also on path or it should fail. (right?)

If you remove firefox & geckodriver from PATH, Selenium will just grab Firefox & geckodriver from the internet and use that.

@benken-parasoft
Copy link

For selenium-java, I just follow the solution from issue 7788, where you create a custom File object that overrides getCanonicalPath(). This is hacky but works:

    public static FirefoxDriver getFirefoxDriver() {
        FirefoxOptions options = new FirefoxOptions();
        GeckoDriverService service = null;
        File snapGeckoDriver = new File("/snap/bin/geckodriver") {
            @Override
            public String getCanonicalPath() throws IOException {
                return getAbsolutePath();
            }
        };
        if (snapGeckoDriver.exists()) {
            service = new GeckoDriverService.Builder().usingDriverExecutable(snapGeckoDriver).build();
        }
        return service != null ? new FirefoxDriver(service, options) : new FirefoxDriver(options);
    }

@bonigarcia
Copy link
Member

@fvue I created a new Selenium Manager version that avoids resolving symbolic links for found browsers. This should fix the problems related to snap Firefox.

To check it, please download and uncompress the following binary: selenium-manager_linux-x64, run the following command, and share the results here, thanks:

 ./selenium-manager --debug --browser firefox

@fvue
Copy link

fvue commented Oct 6, 2023

The downloaded binary:

$ ./selenium-manager --version
selenium-manager 0.4.14
$ ./selenium-manager --debug --browser firefox
DEBUG   Found geckodriver 0.33.0 in PATH: /snap/bin/geckodriver
DEBUG   Found firefox in PATH: /snap/bin/firefox
DEBUG   Running command: /snap/bin/firefox -v
DEBUG   Output: "Mozilla Firefox 118.0.1"
DEBUG   Detected browser: firefox 118.0.1
DEBUG   Required driver: geckodriver 0.33.0
INFO    Driver path: /snap/bin/geckodriver
INFO    Browser path: /snap/bin/firefox

This is the output with selenium-webdriver-4.13.1, so the new version 0.4.14 gives better result indeed (/snap/bin/firefox instead of /usr/bin/snap):

~/.rvm/gems/ruby-3.1.4@travelsim/gems/selenium-webdriver-4.13.1/bin/linux$ ./selenium-manager --version
selenium-manager 0.4.13
~/.rvm/gems/ruby-3.1.4@travelsim/gems/selenium-webdriver-4.13.1/bin/linux$ ./selenium-manager --debug --browser firefox
DEBUG   Found geckodriver 0.33.0 in PATH: /snap/bin/geckodriver
DEBUG   Found firefox in PATH: /usr/bin/snap
DEBUG   Running command: /usr/bin/snap -v
DEBUG   Output: ""
DEBUG   Running command: "/snap/bin/firefox" -v
DEBUG   Output: "Mozilla Firefox 118.0.1"
DEBUG   Detected browser: firefox 118.0.1
DEBUG   Required driver: geckodriver 0.33.0
INFO    Driver path: /snap/bin/geckodriver
INFO    Browser path: /usr/bin/snap

But if I replace just selenium-manager (at ~/.rvm/gems/ruby-3.1.4@travelsim/gems/selenium-webdriver-4.13.1/bin/linux/selenium-manager) with v0.4.14 (was: 0.4.13), my ruby system test still fails:

~/.rvm/gems/ruby-3.1.4@travelsim/gems/selenium-webdriver-4.13.1/bin/linux$ ./selenium-manager --version
selenium-manager 0.4.14
2023-10-06 16:00:58 DEBUG Selenium [:selenium_manager] Selenium Manager binary found at /home/usr2/.rvm/gems/ruby-3.1.4@travelsim/gems/selenium-webdriver-4.13.1/bin/linux/selenium-manager
2023-10-06 16:00:58 DEBUG Selenium [:selenium_manager] Executing Process ["/home/usr2/.rvm/gems/ruby-3.1.4@travelsim/gems/selenium-webdriver-4.13.1/bin/linux/selenium-manager", "--browser", "firefox", "--output", "json", "--debug"]
2023-10-06 16:00:59 DEBUG Selenium [:selenium_manager] Found geckodriver 0.33.0 in PATH: /snap/bin/geckodriver
2023-10-06 16:00:59 DEBUG Selenium [:selenium_manager] Found firefox in PATH: /snap/bin/firefox
2023-10-06 16:00:59 DEBUG Selenium [:selenium_manager] Running command: /snap/bin/firefox -v
2023-10-06 16:00:59 DEBUG Selenium [:selenium_manager] Output: "Mozilla Firefox 118.0.1"
2023-10-06 16:00:59 DEBUG Selenium [:selenium_manager] Detected browser: firefox 118.0.1
2023-10-06 16:00:59 DEBUG Selenium [:selenium_manager] Required driver: geckodriver 0.33.0
2023-10-06 16:00:59 DEBUG Selenium [:selenium_manager] Driver path: /snap/bin/geckodriver
2023-10-06 16:00:59 DEBUG Selenium [:selenium_manager] Browser path: /snap/bin/firefox
2023-10-06 16:00:59 DEBUG Selenium [:driver_service] Executing Process ["/snap/bin/geckodriver", "--port=4444"]
2023-10-06 16:00:59 DEBUG Selenium [:process] Starting process: ["/snap/bin/geckodriver", "--port=4444"] with {[:out, :err]=>#<IO:<STDOUT>>, :pgroup=>true}
2023-10-06 16:00:59 DEBUG Selenium [:process]   -> pid: 81072
2023-10-06 16:00:59 DEBUG Selenium [:driver_service] polling for socket on ["127.0.0.1", 4444]
1696600859533   geckodriver     INFO    Listening on 127.0.0.1:4444
2023-10-06 16:00:59 DEBUG Selenium [:command] -> POST session
2023-10-06 16:00:59 DEBUG Selenium [:command]    >>> http://127.0.0.1:4444/session | {"capabilities":{"alwaysMatch":{"acceptInsecureCerts":true,"browserName":"firefox","moz:firefoxOptions":{"binary":"/snap/bin/firefox","args":["-headless"]},"moz:debuggerAddress":true}}}
2023-10-06 16:00:59 DEBUG Selenium [:header]      > {"Accept"=>"application/json", "Content-Type"=>"application/json; charset=UTF-8", "User-Agent"=>"selenium/4.13.1 (ruby linux)", "Content-Length"=>"185"}
2023-10-06 16:00:59 DEBUG Selenium [:header]    <<<  {"content-type"=>["application/json; charset=utf-8"], "cache-control"=>["no-cache"], "content-length"=>["101"], "date"=>["Fri, 06 Oct 2023 14:00:59 GMT"]}
2023-10-06 16:00:59 DEBUG Selenium [:command] <- {"value":{"error":"invalid argument","message":"binary is not a Firefox executable","stacktrace":""}}
2023-10-06 16:00:59 DEBUG Selenium [:selenium_manager] Executing Process ["/home/usr2/.rvm/gems/ruby-3.1.4@travelsim/gems/selenium-webdriver-4.13.1/bin/linux/selenium-manager", "--browser", "firefox", "--browser-path", "/snap/bin/firefox", "--output", "json", "--debug"]
2023-10-06 16:01:00 DEBUG Selenium [:selenium_manager] Found geckodriver 0.33.0 in PATH: /snap/bin/geckodriver
2023-10-06 16:01:00 DEBUG Selenium [:selenium_manager] Running command: /snap/bin/firefox -v
2023-10-06 16:01:00 DEBUG Selenium [:selenium_manager] Output: "Mozilla Firefox 118.0.1"
2023-10-06 16:01:00 DEBUG Selenium [:selenium_manager] Detected browser: firefox 118.0.1
2023-10-06 16:01:00 DEBUG Selenium [:selenium_manager] Required driver: geckodriver 0.33.0
2023-10-06 16:01:00 DEBUG Selenium [:selenium_manager] Driver path: /snap/bin/geckodriver
2023-10-06 16:01:00 DEBUG Selenium [:selenium_manager] Browser path: /snap/bin/firefox
2023-10-06 16:01:00 DEBUG Selenium [:driver_service] Executing Process ["/snap/bin/geckodriver", "--port=4445"]
2023-10-06 16:01:00 DEBUG Selenium [:process] Starting process: ["/snap/bin/geckodriver", "--port=4445"] with {[:out, :err]=>#<IO:<STDOUT>>, :pgroup=>true}
2023-10-06 16:01:00 DEBUG Selenium [:process]   -> pid: 81306
2023-10-06 16:01:00 DEBUG Selenium [:driver_service] polling for socket on ["127.0.0.1", 4445]
1696600860345   geckodriver     INFO    Listening on 127.0.0.1:4445
2023-10-06 16:01:00 DEBUG Selenium [:command] -> POST session
2023-10-06 16:01:00 DEBUG Selenium [:command]    >>> http://127.0.0.1:4445/session | {"capabilities":{"alwaysMatch":{"acceptInsecureCerts":true,"browserName":"firefox","moz:firefoxOptions":{"binary":"/snap/bin/firefox","args":["-headless"]},"moz:debuggerAddress":true}}}
2023-10-06 16:01:00 DEBUG Selenium [:header]      > {"Accept"=>"application/json", "Content-Type"=>"application/json; charset=UTF-8", "User-Agent"=>"selenium/4.13.1 (ruby linux)", "Content-Length"=>"185"}
2023-10-06 16:01:00 DEBUG Selenium [:header]    <<<  {"content-type"=>["application/json; charset=utf-8"], "cache-control"=>["no-cache"], "content-length"=>["101"], "date"=>["Fri, 06 Oct 2023 14:01:00 GMT"]}
2023-10-06 16:01:00 DEBUG Selenium [:command] <- {"value":{"error":"invalid argument","message":"binary is not a Firefox executable","stacktrace":""}}

@bonigarcia
Copy link
Member

The new version of Selenium Manager seems to work correctly:

INFO    Driver path: /snap/bin/geckodriver
INFO    Browser path: /snap/bin/firefox

So, I don't understand why your test fails with binary is not a Firefox executable.

@titusfortner: Any idea about this?

@titusfortner
Copy link
Member

Don't try to replace it in the rvm, set the environment variable to the location of your selenium manager:

ENV['SE_MANAGER_PATH'] = 'path/to/selenium-manager'

@titusfortner
Copy link
Member

It's weird that it's the snap geckodriver complaining about the snap firefox... the syntax looks correct

@titusfortner
Copy link
Member

titusfortner commented Oct 6, 2023

@diemol
Copy link
Member

diemol commented Oct 19, 2023

Looks like this issue is now a collection of different variations, and we have not heard much from folks in the last weeks.

I will close this for now, but if you are still having an issue inside the Jenkins Linux container, please comment and we will reopen. For something different, please open a new issue.

@diemol diemol closed this as completed Oct 19, 2023
Copy link

github-actions bot commented Dec 2, 2023

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked and limited conversation to collaborators Dec 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

8 participants