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

Selenium node does not pass the command line arguments to geckodriver #4730

Closed
soosrol opened this issue Sep 20, 2017 · 11 comments
Closed

Selenium node does not pass the command line arguments to geckodriver #4730

soosrol opened this issue Sep 20, 2017 · 11 comments

Comments

@soosrol
Copy link

soosrol commented Sep 20, 2017

Meta -

OS: Windows 10
Selenium Version: 3.5.*, 3.4.0
Browser: Firefox
Browser Version: 55.0.3 (64-bit)

On versions 3.5.0 and higher, Selenium node does not pass the command line arguments to geckodriver.

Expected Behavior -

If the node receives moz:firefoxOptions with args, all args should be passed to geckodriver so that Firefox can be started with the correct command line params.

Actual Behavior -

Args are not being passed to geckodriver. Tested with -profile.

Steps to reproduce -

  1. Have selenium grid set up and running
  2. Create your browser with the following Firefox options:
FirefoxOptions options = new FirefoxOptions(); 
options.addArguments("-profile", "./firefoxprofile");
  1. Observe the Selenium node log (args are not passed to geckodriver)
12:32:14.961 INFO - Capabilities {androidServerPort=7100, appInstall=true, marionette=true, browserName=firefox, serverPort=5769, moz:firefoxOptions={args=[-profile, ./firefoxprofile], prefs={}, }, platformName=ANY, version=, uuid=09af7ada-5a10-4840-a58b-358..., platform=ANY, } matched class org.openqa.selenium.remote.server.ServicedSession$Factory (provider: org.openqa.selenium.chrome.ChromeDriverService)
1505935934992   geckodriver     INFO    geckodriver 0.19.0
1505935935008   geckodriver     INFO    Listening on 127.0.0.1:5137
1505935935586   mozrunner::runner       INFO    Running command: "C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe" "-marionette" "-profile" "C:\\Users\\Selenium\\AppData\\Local\\Temp\\rust_mozprofile.Fb9H6o79oRbe"

Variations -

  • Reproducible using Selenium v3.5.0, v3.5.1, v3.5.2, v.3.5.3 using geckodriver v0.16, v0.17, v0.18, v0.19
  • Using Selenium v3.4.0 and geckodriver v0.19, the browser is started with the correct args, but Selenium hangs (the browser itself remains functional)
@lmtierney
Copy link
Member

Is the profile you're trying to use on the local machine or on the node machine?

@soosrol
Copy link
Author

soosrol commented Sep 21, 2017

The profile is on the node, that's why I'm passing the path in the args.

@lmtierney
Copy link
Member

You're trying to use a relative path though? Can you try using an absolute path? I believe the preferred method for using a profile at the node is by using -Dwebdriver.firefox.profile= when starting the node

@soosrol
Copy link
Author

soosrol commented Sep 21, 2017

I get the same result with absolute path too, as well as using -Dwebdriver.firefox.profile= when starting the node.

Looking at the below logs, pretty much the same thing happens in both cases. Does Selenium create a temporary profile when starting the browser? Could that be overriding the -profile argument?

With absolute path passed through FirefoxOptions:

09:51:58.921 INFO - Capabilities are: Capabilities {androidServerPort=7100, appInstall=true, marionette=true, browserName=firefox, serverPort=5769, moz:firefoxOptions={args=[-profile, C:\Selenium Grid\firefoxpro...], prefs={}, }, platformName=ANY, version=, uuid=351ebd8c-a6e3-440e-81e6-86e..., platform=ANY, }
09:51:58.921 INFO - Capabilities {androidServerPort=7100, appInstall=true, marionette=true, browserName=firefox, serverPort=5769, moz:firefoxOptions={args=[-profile, C:\Selenium Grid\firefoxpro...], prefs={}, }, platformName=ANY, version=, uuid=351ebd8c-a6e3-440e-81e6-86e..., platform=ANY, } matched class org.openqa.selenium.remote.server.ServicedSession$Factory (provider: org.openqa.selenium.firefox.GeckoDriverService)
09:51:58.921 INFO - Capabilities {androidServerPort=7100, appInstall=true, marionette=true, browserName=firefox, serverPort=5769, moz:firefoxOptions={args=[-profile, C:\Selenium Grid\firefoxpro...], prefs={}, }, platformName=ANY, version=, uuid=351ebd8c-a6e3-440e-81e6-86e..., platform=ANY, } matched class org.openqa.selenium.remote.server.ServicedSession$Factory (provider: org.openqa.selenium.firefox.GeckoDriverService)
09:51:58.921 INFO - Capabilities {androidServerPort=7100, appInstall=true, marionette=true, browserName=firefox, serverPort=5769, moz:firefoxOptions={args=[-profile, C:\Selenium Grid\firefoxpro...], prefs={}, }, platformName=ANY, version=, uuid=351ebd8c-a6e3-440e-81e6-86e..., platform=ANY, } matched class org.openqa.selenium.remote.server.ServicedSession$Factory (provider: org.openqa.selenium.chrome.ChromeDriverService)
1506012718968   geckodriver     INFO    geckodriver 0.19.0
1506012718968   geckodriver     INFO    Listening on 127.0.0.1:38779
1506012719546   mozrunner::runner       INFO    Running command: "C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe" "-marionette" "-profile" "C:\\Users\\Selenium\\AppData\\Local\\Temp\\rust_mozprofile.lirw97HEgDO9"

With using -Dwebdriver.firefox.profile=


09:50:33.374 INFO - Capabilities are: Capabilities {androidServerPort=7100, appInstall=true, marionette=true, browserName=firefox, serverPort=5769, platformName=ANY, version=, uuid=264b5369-464e-4c13-a55c-80e..., platform=ANY, }
09:50:33.374 INFO - Capabilities {androidServerPort=7100, appInstall=true, marionette=true, browserName=firefox, serverPort=5769, platformName=ANY, version=, uuid=264b5369-464e-4c13-a55c-80e..., platform=ANY, } matched class org.openqa.selenium.remote.server.ServicedSession$Factory (provider: org.openqa.selenium.firefox.GeckoDriverService)
09:50:33.374 INFO - Capabilities {androidServerPort=7100, appInstall=true, marionette=true, browserName=firefox, serverPort=5769, platformName=ANY, version=, uuid=264b5369-464e-4c13-a55c-80e..., platform=ANY, } matched class org.openqa.selenium.remote.server.ServicedSession$Factory (provider: org.openqa.selenium.chrome.ChromeDriverService)
1506012633421   geckodriver     INFO    geckodriver 0.19.0
1506012633436   geckodriver     INFO    Listening on 127.0.0.1:7059
1506012634030   mozrunner::runner       INFO    Running command: "C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe" "-marionette" "-profile" "C:\\Users\\Selenium\\AppData\\Local\\Temp\\rust_mozprofile.5xWanKN3PnXO"

@lmtierney
Copy link
Member

I'll have to defer to the java folks on this one. I've never seen someone pass the profile as a service argument so I'm not sure what's going on. @barancev thoughts?

@jeremco
Copy link

jeremco commented Oct 16, 2017

I have exactly the same problem using -Dwebdriver.firefox.profile. The profile is no longer given to geckodriver. Works with selenium 3.4

@soosrol
Copy link
Author

soosrol commented Oct 16, 2017

After updating to the latest selenium & geckodriver, the profile is now being loaded, but the driver hangs upon browser creation.

Selenium version: 3.6.0
Geckodriver version: 0.19
Firefox version: 55.0.3.6445

@barancev
Copy link
Member

I'm not sure what's expected behavior in this case, but the issue should be raised on the geckodriver. Selenium passes this CLI option as part of capabilities, but geckodriver changes it to something different.

@nilzao
Copy link

nilzao commented Jan 11, 2018

my setup:

  • ubuntu 16.04
  • java 1.8.0_151 (oracle)
  • selenium grid v.3.8.1 running at another computer same lan.
  • firefox 57.0.4 (64bit)
  • geckodriver v0.19.1 (64bit)
  • selenium-server-standalone-3.4.0 (works with -Dwebdriver.firefox.profile=selenium)
  • selenium-server-standalone-3.8.1 (not working with -Dwebdriver.firefox.profile=selenium)

both gecko logs from 3.4.0 and 3.8.1 show calling firefox using new temporary profile.

my local node.sh file

#!/bin/bash
java -Dwebdriver.gecko.driver=/opt/selenium/geckodriver/geckodriver \
 -Dwebdriver.firefox.profile=selenium \
 -jar selenium-server-standalone-3.4.0.jar \
 -role node \
 -nodeConfig nodeConfig-linux.json

my nodeConfig-linux.json file:

{
"capabilities":
  [
    {
      "browserName": "firefox",
      "maxInstances": 5,
      "seleniumProtocol": "WebDriver",
      "alwaysMatch": {
        "moz:firefoxOptions":{
        "args": ["-profile", "/home/nils/.mozilla/firefox/k3jue24y.selenium"]
        }
      }
  }
  ],
  "proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
  "host": "192.168.22.16",
  "maxSession": 5,
  "port": 5555,
  "register": true,
  "registerCycle": 5000,
  "hub": "http://192.168.20.56:4444",
  "nodeStatusCheckTimeout": 5000,
  "nodePolling": 5000,
  "role": "node",
  "unregisterIfStillDownAfter": 60000,
  "downPollingLimit": 2,
  "debug": false,
  "servlets" : [],
  "withoutServlets": [],
  "custom": {},
  "marionette" : true
}

grid console shows the moz:firefoxOptions from the node

@namedgraph
Copy link

namedgraph commented Jan 28, 2018

I am following this guide:
https://github.com/SeleniumHQ/docker-selenium/wiki/How-to-use-a-Firefox-custom-profile
I have mounted a profile directly to node-firefox container, pass -e JAVA_OPTS=-Dwebdriver.firefox.profile= value, but it is ignored by Firefox and a temp profile is used:

12:49:52.086 INFO - Capabilities are: Capabilities {acceptInsecureCerts: true, browserName: firefox, moz:firefoxOptions: {args: [], prefs: {}}}
12:49:52.088 INFO - Capabilities {acceptInsecureCerts: true, browserName: firefox, moz:firefoxOptions: {args: [], prefs: {}}} matched class org.openqa.selenium.remote.server.ServicedSession$Factory (provider: org.openqa.selenium.firefox.GeckoDriverService)
1517143792123	geckodriver	INFO	geckodriver 0.19.1
1517143792134	geckodriver	INFO	Listening on 127.0.0.1:12360
1517143792286	mozrunner::runner	INFO	Running command: "/usr/bin/firefox" "-marionette" "-profile" "/tmp/rust_mozprofile.XaBBRVcr2xAW"

Is the guide outdated?

@namedgraph
Copy link

Whan I pass profile as an argument from my test (instead of -e JAVA_OPTS=-Dwebdriver.firefox.profile=)

FirefoxOptions options = new FirefoxOptions();
options.setAcceptInsecureCerts(true);
options.addArguments("-profile", "/home/seluser/.mozilla/firefox/unauthorized-profile");

I can see it being used:

1517155759616	mozrunner::runner	INFO	Running command: "/usr/bin/firefox" "-marionette" "-profile" "/home/seluser/.mozilla/firefox/unauthorized-profile"

But then the test cannot get a connection to Firefox node anymore. Firefox log:

16:07:17.536 INFO - Trying to create a new session on test slot {seleniumProtocol=WebDriver, se:CONFIG_UUID=eabe3cbd-445a-43ed-939b-f0f01669f776, browserName=firefox, maxInstances=1, moz:firefoxOptions={log={level=info}}, version=57.0.4, applicationName=, platform=LINUX}
16:08:18.686 INFO - Got a request to create a new session: Capabilities {acceptInsecureCerts: true, browserName: firefox, moz:firefoxOptions: {args: [-profile, /home/seluser/.mozilla/fire...], prefs: {}}}

@soosrol it can be we are hitting this bug:
mozilla/geckodriver#1058

@lock lock bot locked and limited conversation to collaborators Aug 16, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants