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

Nightwatch doesnt work with firefox with profile #1543

Closed
Frankusky opened this issue Aug 5, 2017 · 26 comments
Closed

Nightwatch doesnt work with firefox with profile #1543

Frankusky opened this issue Aug 5, 2017 · 26 comments
Labels

Comments

@Frankusky
Copy link

I have create a firefox profile that has a theme set (just for testing that indeed is using the specified profile). Im making firefox use that profile by passing the following configuration:

  "moz:firefoxOptions": {
    "args": ["-profile", "bin/hfilsojg.nightwatchProfile"]
  }

But when I use the profile, my nightwatch test will only open the browser but wont execute any other command. I need to load a profile to test some extensions behavior and to set a proxy.

@wieta
Copy link

wieta commented Aug 5, 2017

Hi,
I had same issue runing firefox with specify profile. I use docker container for ff browser and I mount ff profile dir i.e /root/.mozilla/firefox and then i base64 this path and in nightwatch config json file i have:

"moz:firefoxOptions":{ "binary": "/usr/bin/firefox", "args": ["-P"], "profile": "L3Jvb3QvLm1vemlsbGEvZmlyZWZveA==" }

@Frankusky
Copy link
Author

Frankusky commented Aug 5, 2017

@wieta as far as I tested, the -P flag will only open the firefox profile manager if you dont pass a value, you should send something like my example in order to use a profile from a path or only send the name of the profile if your profile is in the firefox profiles path.

@wieta
Copy link

wieta commented Aug 7, 2017

Sorry for delay, yes you right, but this settings works for me, I've spent many time looking for working solution and found this one. Did you tried this solution ?

@Frankusky
Copy link
Author

@wieta I recently tried but is not working, here is the settings I used:

  "moz:firefoxOptions": {
      "args": ["-P"],
      "profile": "YmluL2hmaWxzb2pnLm5pZ2h0d2F0Y2hQcm9maWxl"
  }

It pop ups the firefox profile manager even when I have the "Use the selected profile without asking at startup" option enabled. Adding the binary path will show an error message: Connection refused! Is selenium server started?

Are you using selenium-server-standalone-3.4.0 and geckodriver v0.18.0?

@wieta
Copy link

wieta commented Aug 7, 2017

Ok i think i know your issue, i gave you solve to use docker with standalone firefox driver(i am not sure but may be it works also locally) let try something like this: in your nightwatch settings, in sections

"selenium" : {
    "start_process" : true,
        "server_path" : "./bin/selenium-server-standalone-3.4.0.jar",
        "log_path" : "",
        "port" : 4444,
        "cli_args" : {
            "webdriver.chrome.driver" : "./bin/chromedriver",
            "webdriver.gecko.driver" : "./bin/geckodriver",
            "webdriver.firefox.profile" : "nightwatch"
        }
},

This work for my locally enviroment "webdriver.firefox.profile" : "nightwatch"

@Frankusky
Copy link
Author

OMG. Its working with a profile that is set in the profile manager 😄 How can I set a path instead? It returns an error message when I try to set a path

@wieta
Copy link

wieta commented Aug 7, 2017

Great :D, i think you should run ff from binary "binary": "/usr/bin/firefox" and args -p and profile path should work without prompt to choose profile. Ok i've checked where you should add and if you have default desiredcapabilities:

"desiredCapabilities": {
                "browserName": "firefox",
                "javascriptEnabled": true,
                "marionette": true,
                "acceptSslCerts": true,
                "moz:firefoxOptions": {
                  "binary": "/Applications/Firefox.app/Contents/MacOS/firefox-bin",
                  "args": ["-P"],
                  "profile": "Li90bXAvZmlyZWZveA=="
                }
            } 

and the "Li90bXAvZmlyZWZveA==" is my profil location /tmp/firefox inside firefox dir i have somechars.nightwatch. Let me know if this solution will work

@Frankusky
Copy link
Author

Frankusky commented Aug 7, 2017

Nope, still showing the profile manager, also for me the binary path has to include the executable file name (probably because windows 😩 )

Also I have tried with the profile folder itself (not his parent folder) and nothing, still showing the profile manager

Absolute/relative path doesn't works too

@wieta
Copy link

wieta commented Aug 7, 2017

so when you run /firefox.exe -P you allways get prompt with choose profil ? I want to help you but i don't have any widnows pc at the moment:( Maybe better way is to run ff on docker container ?

@Frankusky
Copy link
Author

Yes, only with firefox.exe -P will show the profile manager, at the moment it looks that the only way it wont show the profile manager is to pass the name of the profile. I'm not familiarized with docker 😞

@Frankusky
Copy link
Author

Frankusky commented Aug 8, 2017

I found a workaround to use a premade firefox profile:

  1. Open %APPDATA%\Mozilla\Firefox\profiles.ini
  2. Add the following configuration
[Profile<number>]
Name=<profile_name>
IsRelative=0
Path=<absolute path to your profile>

Example:

[Profile3]
Name=Nightwatch
IsRelative=0
Path=C:\Nightwatch\firefoxProfile\xcz6tuvq.Nightwatch
  1. In your cli_args of the selenium configuration use the same profile name specified before:
"webdriver.firefox.profile" : "<profile_name>",

Example:

"webdriver.firefox.profile" : "Nightwatch",

@raaaaay-c
Copy link

raaaaay-c commented Aug 25, 2017

you can do "args": ["-P","nightwatch"]

-P profilename can run firefox in specific profile without manager opens

In command line would be :
location\to\firefox -P nightwatch

if you don't have the specific profile, it opens profile manager.

@Frankusky
Copy link
Author

@raymonduui I was more interested in using a profile within a path, since my profile is commited into a git repository, so for each machine I dont have to install it manually.

@NightwatchTele
Copy link

NightwatchTele commented Aug 26, 2017

I had the same issue. Had gone mad for few days, different configurations, code etc...I almost gave up.
I also read this post few days back but returned it today.
The major issue for me, if i put marionette:false nightwatch profile is opened but nothing from the test is executing Null pointer reference error. But setting the marionette:false i think it means the gecko driver is not loading up (don't have in-depth knowledge on the subject was only comparing my logs)

So several days later frustrated to the max i tried downgrading from Selenium 3.5.0 to 3.4.0 trying to mimic @Frankusky comment above "Are you using selenium-server-standalone-3.4.0 and geckodriver v0.18.0?" and voila works like a charm, tests passes, browser opened up with the desired profile.

With this working configuration if i return to Selenium 3.5.0 (currently latest ver) Firefox is opened up with anonymous profile (not the specified one, don't know why though) and It puts only the URL from the test and fails immediately on the first line (which in my test is .waitForElementVisible("body", 1000)). So if i say there is a regression issue or a new issue in the Selenium 3.5.0 standalone i might be wrong, but than again i might have located a bug in it.

@Zechtitus
Copy link

Zechtitus commented Sep 8, 2017

@NightwatchTele - I just stumbled on this as well with Selenium 3.5 and the node-firefox-debug... went back to 3.4 and worked fine. Same issues with the waitForElementVisible / waitForElementPresent, setValue type methods.

Regardless, thanks! you saved me a lot of time from pulling my hair out!

BTW - for the 3.5.0 issue were you going to submit a bug for that? I can add any information to the bug report if that helps

@NightwatchTele
Copy link

@Zechtitus well at least one of us left with more hair. Pardon for not replying sooner. I wanted to submit the issue to Selenium, however very soon after i posted this i went away for a while. Let me know if you have submitted the as i was planning on doing it (so we avoid double submission)

@Zechtitus
Copy link

@NightwatchTele - submitted nothing ;) go ahead!

@Frankusky
Copy link
Author

I'm facing again this issue due upgrade to Firefox Quantum 😞 My workaround stop working.

Firefox version: 57.0.4 (64 bit)
Selenium Version: 3.8.1
Geckodriver version: 0.18.0 (also with 0.19.1 doesnt work)

@NightwatchTele
Copy link

Try downgrading to Selenium 3.4.0

@Frankusky
Copy link
Author

I remember that I was facing some issue with chrome and thats why I changed to that selenium version, however, reverting to 3.4.0 version its working fine at both browsers 😮 Thanks

@Zechtitus
Copy link

Is downgrading to an absolete firefox really a workaround though?

@jbione
Copy link

jbione commented Aug 13, 2018

I'm facing the exact same issue. Is there any solution that doesn't require to downgrade the version of Selenium or Firefox?
I need to do the same thing that @Frankusky was trying to do. I'm commiting the profile to a git repository, so I need to use a profile with a path.
Thanks.

@ajpetersons
Copy link
Contributor

@jbione seems like geckodriver issue to me. mozilla/geckodriver#1058 (comment) helped me to get back on track after a day of struggle

@jbione
Copy link

jbione commented Aug 15, 2018

Thanks so much @ajpetersons ! Awesome workaround. Working great on Selenium 3.14.0 and Geckodriver 0.21.0 😄

@aberonni
Copy link
Collaborator

So I guess we can close this, not a Nightwatch issue?

@stale
Copy link

stale bot commented Nov 18, 2018

This issue has been automatically marked as stale because it has not had any recent activity.
If possible, please retry using the latest Nightwatch version and update the issue with any relevant details. If no further activity occurs, it will be closed. Thank you for your contribution.

@stale stale bot added the stale label Nov 18, 2018
@stale stale bot closed this as completed Nov 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

8 participants