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

default Firefox profile is using orange URL bar with robot icon after trying to use a custom profile #1773

Closed
baptx opened this issue Sep 10, 2020 · 5 comments

Comments

@baptx
Copy link

baptx commented Sep 10, 2020

System

  • Version: geckodriver 0.27.0 (7b8c4f32cdde 2020-07-28 18:16 +0000)
  • Platform: Linux + Lubuntu 20.04
  • Firefox: 80.0.1 (64-bit)
  • Selenium: Node.js v10.19.0 + Selenium WebDriver 4.0.0-alpha.7

Testcase

Using the WebDriver example from https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Headless_mode, I tried to use a custom Firefox profile named "test" by replacing options.addArguments("-headless"); with options.addArguments("-P test -headless");. However it looks like the command did not work correctly and the WebDriver script was opened in my default Firefox profile.
Now everytime I want to browse websites with my default Firefox profile, I can see the orange search bar with robot icon. How do I get it back to normal? Maybe there is a preference to change in pref.js file or about:config.
What is the correct way to use an existing profile with a Selenium WebDriver script? I want to use an existing profile instead of a temporary one, in order to have persistent cookies that don't get removed after running a script. I tried the lowercase "-p" instead of uppercase "-P" but it was not working (by the way I think this is a mistake in Mozilla documentation, it should be lowercase "-p").

Update: I don't know how it is detected but I noticed I am not even able to log in to gmail.com with my profile, the website says: "Couldn't sign you in
This browser or app may not be secure. Learn more
Try using a different browser. If you’re already using a supported browser, you can refresh your screen and try again to sign in."

Update 2: I read that the bot detection can come from the JavaScript variable navigator.webdriver:
https://www.edureka.co/community/79066/avoid-bot-detection-not-working-with-selenium
https://stackoverflow.com/questions/53039551/selenium-webdriver-modifying-navigator-webdriver-flag-to-prevent-selenium-detec/53040904#53040904
I found how to disable it, in addition to the orange URL bar with robot icon. We have to go to about:config and set marionette.enabled to false (it is set permanently to true when starting Firefox with the --marionette parameter):
https://developer.mozilla.org/en-US/docs/Web/API/Navigator/webdriver

Now I just need to know how to use a custom Firefox profile with Selenium WebDriver.

@baptx baptx changed the title default Firefox profile is using orange search bar with robot icon after using GeckoDriver and Selenium WebDriver default Firefox profile is using orange search bar with robot icon after trying to use a custom profile Sep 10, 2020
@baptx baptx changed the title default Firefox profile is using orange search bar with robot icon after trying to use a custom profile default Firefox profile is using orange URL bar with robot icon after trying to use a custom profile Sep 10, 2020
@whimboo
Copy link
Collaborator

whimboo commented Sep 11, 2020

You can go to about:config and reset all the preferences starting with marionette.. That will fix your problem.

Using a custom profile can be done by specifying it via the firefoxOptions, or by using the --profile argument of Firefox. But keep in mind that the latter isn't that easy due to some missing features. See issue #1058.

@baptx
Copy link
Author

baptx commented Apr 18, 2021

@whimboo there was also an issue to type some French accents so I had to change the preference focusmanager.testmode from true to false and restart Firefox: https://bugs.launchpad.net/ubuntu/+source/firefox/+bug/1924586
Could it be a Firefox bug that when focusmanager.testmode is enabled, we cannot type characters like ê and ï?

@whimboo
Copy link
Collaborator

whimboo commented Apr 18, 2021

Maybe, but I don't know. While under automation we expect no manual text input from an user.

Nevertheless with https://bugzilla.mozilla.org/show_bug.cgi?id=1632821 fixed for Firefox 88, the default profile will no longer have Marionette enabled if Firefox has been started without --marionette.

@baptx
Copy link
Author

baptx commented Apr 19, 2021

@whimboo thanks, I think user input could still be useful to resolve a CAPTCHA. Last year I also left a comment here, in case you have more information: #1058 (comment)

@whimboo
Copy link
Collaborator

whimboo commented Apr 19, 2021

@whimboo thanks, I think user input could still be useful to resolve a CAPTCHA.

This interrupts automation flow, so it shouldn't be really used. But anyway, if some letters don't come through with focus manager enabled, it's more a Firefox bug. Please check by creating a new Firefox profile, and just setting this preference. If that is also happening outside of Marionette / geckodriver feel free to file a bug directly on https://bugzilla.mozilla.org/enter_bug.cgi.

Last year I also left a comment here, in case you have more information: #1058

Sorry, but we don't have an update yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants