-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Unable to create new session using a custom profile #1058
Comments
So when you log into the node, can you see that Firefox is getting started at all? I would expect at least the Firefox log to be present in the trace log. I assume you followed https://firefox-source-docs.mozilla.org/testing/geckodriver/geckodriver/TraceLogs.html? |
I am also surprised to not find any stdout output from Firefox after the |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@soosrol, does Firefox in those failing cases show the robot in the location bar? Also have a look at the browser console (tools menu) if there are some errors reported for Marionette. Regarding the logs, usually all output should (for the time being) end up in the same log file. But I don't know anything about the remove driver to give a qualified answer in how it works. |
@whimboo, yes, it has the robot in the address bar. Also checked the browser console, and as far as I can tell, it doesn't have any relevant errors. See attached screenshots. |
@soosrol I'm loading a profile in a few cases but most cases do not use profiles at all. |
@soosrol interesting! It reminds me on a case we occasionally see in our automated tests but which is so seldom that I wasn't able to hit it so far. Is that reproducible for you all the time? Does it also happen when you are not creating a new profile but let geckodriver do it? I would like to know what the minimal testcase is for you. Also I would like to see a real trace level log. Would be fantastic if you can find out where this is stored on the hub. Btw. is that a new issue you are facing with the 57 release, or did it already exist with 56? |
@whimboo I can reproduce it every time. Everything works flawlessly if I don't specify a profile to load. This has been the same ever since I first tried it 2-3 Firefox versions ago and since Selenium 3.4 and geckodriver 17 or so... What's really strange, is that I only encounter this issue if I pass in the command line arg for loading the profile from local drive. If I generate/load the profile within my tests by using
the profile gets loaded and and the session is started without an issue. You may ask why I'm not doing it this way, and the answer is simple: I am running my tests on Selenium grid on multiple threads and this would require me to have selenium transfer the profile upon every browser start/restart. My custom profile contains a browser extension, that is ~20MB in size. Having a profile of this size transferred by selenium grid is not just very slow, but also very fragile, as after 2-3 tries I always get Java heap space exception, regardless of the allowed memory in JVM settings. |
Thank you for the update @soosrol. It looks great to have a reduced testcase now. One thing you could help us with is, can you please try if you can get the same issue reproduced when not running the test on the hub but locally? Does that produce the same failure? Otherwise, @andreastt do you have an idea? Without having trace logs for that problem, I'm meanwhile out of ideas. |
@whimboo: I've tried running the same comparison (starting with/without the profile arg) on my local machine and I got the exact same results. I think this rules out most of the environmental causes, as my local machine is a Mac, unlike my grid that runs on Windows VMs. See attached logs for both sessions: Selenium version: 3.7.1 |
Amazing to see. It means we are getting closer! Given those results I took the opportunity and had a look myself. Here the results... When trying to use an already existent profile the So I tried to use @soosrol can you please also test the |
The problem with not being able to make a connection to Marionette for the given profile path is, that by default Marionette uses port 2828, but geckodriver takes a random free port. Right now I do not see a way to allow pass-in a fixed port to geckodriver when not starting it manually. Checking the code I can only see that the command line argument So whether we need a capability under |
@whimboo: Yes, the In my opinion you may have just found the root cause with the marionette port! When I don't specify the profile and let it be generated for the session, I can see on At this point I'm trying to see if I can somehow force the geckodriver |
I will file a bug soon so that it can be fixed. As workaround you could start geckodriver manually by passing in |
This comment has been minimized.
This comment has been minimized.
Bug 1421766 is now taking care of it. Thank you for reporting! We really wonder why no-one else has seen this yet. |
This comment has been minimized.
This comment has been minimized.
Any chance someone could clarify the workaround steps for this? I'm using the selenium standalone-firefox-debug docker container and selenium remote webdriver on .NET I tried specifying
but I still have the same behaviour. I'm not at all sure how to check which port is in the profile setup? :-/ I'm not too familiar with selenium or geckodriver and feel like I am missing the point. |
Ah i understand now... In case anyone else was struggling in the same way as I was the So workaround steps are:
Many thanks for the workaround, guys! All back up and running now :-) |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@dncpax in case it helps, the workaround I used is to create a custom WebExtension and load it with Selenium WebDriver instead of loading a whole Firefox profile, for example to have cookies before doing an HTTP request: SeleniumHQ/selenium#8693 (comment) Edit: I also don't know what is @soosrol 's script mentioned by @stewart-r at #1058 (comment), more information are welcome. |
@baptx thanks for replying. My goal is to login automatically so Im using a profile for that which has autoauth extension installed and configured. With this bug I'm stuck. I also use selenium-side-runner to avoid scripting tests. So I'm really stuck... This is such an old bug... |
@dncpax the workaround I use should work for you also, if you load the WebExtension instead of the profile (and write / read session ID stored in e.g. cookies to a file if you want to stay logged in next time you execute the script). |
@baptx that would be wonderful... but I'm working with windows auth... that's the only reason I need a profile and the autoauth extension. Would this work with a webextension? |
A fix for this problem is above in this thread. No idea why it isn't
implemented.
|
@hornschorsch same here... I know everyone does what he/she can, but someone posted 10lines of working code, and somehow it wasn't picked up... not to rant or anything... |
@dncpax What do you mean by windows auth? It is probably possible to do it without profile if you write and read profile data to a file. Where is the 10 lines of working code exactly? |
windows integrated authentication... |
VerifiedThis bug has been open for 4 years. Still seeing this issue on
Further investigation
Fix
|
@globalcitizen Does using |
@saifahn Sorry test environment long since destroyed. |
I've experimented with this and it does not appear to -- If you use |
Can someone who still sees this problem please provide the code that you are using with Selenium? When using a custom profile you will have to make sure to instruct geckodriver to use the appropriate port for Marionette which should be passed to |
@whimboo here's how I'm using it, via etaoin:
Note that by "doesn't work" earlier, I don't mean "it doesn't load the profile", I mean "it loads the profile but doesn't autonegotiate a port to use for Marionette, so unless you manually set one in In the above code, I've constructed an appropriate |
@ToxicFrog thank you for the details. For now I don't have a proper solution yet, but I can say that we are working on it. But please bear with us that it might take some time to finish it. For now here a workaround:
We are aware that this is not optimal but at least a start so that scaling won't be a problem for you anymore. With the above steps each instance of Firefox and Marionette will pick up a free and unique system port. Ongoing work can be tracked via: https://bugzilla.mozilla.org/show_bug.cgi?id=1240830#c16 and ff. For now only step 1 has been done. |
Good news. Recently we landed a patch for geckodriver which by default would allow Marionette to use a system allocated port, and geckodriver then reads that port from the Firefox profile. Anyone with the problem on this issue could you please check this Nightly build of geckodriver. Just click the green When testing please don't force a Marionette port via the Please let us know if it works or not. If it's the latter please attach a trace log. Thanks! |
I've been otherwise occupied this week but I'll try that out next time I'm tinkering with this, which should hopefully be soon. Thanks! |
No luck. In short: geckodriver starts up, and starts firefox; firefox does not write the MarionetteActivePort file, and geckodriver spins endlessly waiting for it to appear until its parent process watchdogs and kills it. The runtime profile directory it's looking for in /run/user does exist. It looks like geckodriver is doing the right thing but FF isn't writing the MarionetteActivePort file; any advice on next steps?
The X11/GL errors show that FF is starting up successfully, and are normal -- it's running headless on a machine with no X server. I can see that Geckodriver and Firefox are both running:
|
Interesting case. So you are specifying a profile name from the profile manager when using For the |
In any case, I'll give it a shot and report back. |
@ToxicFrog can you explain why you need |
I'd completely forgotten about that -- I think that would work better for my use case anyways. I'll try that out and report back, thanks. |
It works! It even works with an existing profile, as long as you don't have |
This is great to hear! So yes, If there is still a problem related to this feature please file a new issue. Otherwise we will ship this new feature with the next geckodriver 0.31.0 release. |
FYI this bug is now fixed and we marked the usage of |
@whimboo Hi, I am referencing this issue to automate the existing Firefox instance by connecting to the marionette.port. According to this issue and many others, it seems like the default port is 2828 for marionette, but I realised the selenium driver connects to the port shown in the image instead (and that marionette.port variable changes every time I relaunch the Firefox browser). Is there a way to fix the marionette port when launching Firefox? ![]() Current workflow:
|
First note that Regarding connecting to an existing instance of Firefox this is not yet fully supported. Especially not with random ports given that geckodriver cannot read the |
System
Testcase
Expected result
Actual result
Notes
fo.addArguments("-profile", "./firefoxprofile");
firefox.exe -profile "path/to/profile"
also works.Stacktrace
Trace-level log
The text was updated successfully, but these errors were encountered: