Open carstenfuchs opened 1 year ago
@carstenfuchs I assume the same is the case when you start Firefox manually? In such a case it would be an issue with the Firefox snap package but not geckodriver, and a bug should be filed similar to all the other ones that are listed as dependency for https://bugzilla.mozilla.org/show_bug.cgi?id=1665641.
Please let me know. Thanks!
Hello @whimboo ,
sorry for not having mentioned this explicitly: The problem does not occur when I start Firefox manually. When started manually, about:support
is in German. Only when started in a testcase as described above is about:support
(and other locale-specific elements, such das the button labels of the built-in PDF viewer) in English.
Ok, so the geckodriver that you are using here is the snap-packaged one as well, right?
Ok, so the geckodriver that you are using here is the snap-packaged one as well, right?
Yes.
After my upgrade to Ubuntu 22.04 LTS I removed the geckodriver that I used until then, so that the snap-packaged is the only one left on my system:
$ find / -iname "*geckodriver*" 2>/dev/null
/snap/firefox/2356/usr/lib/firefox/geckodriver
/snap/bin/geckodriver
/snap/bin/firefox.geckodriver
/home/carsten/Zeiterfassung/.geckodriver.log
/var/lib/snapd/apparmor/profiles/snap.firefox.geckodriver
/var/lib/snapd/seccomp/bpf/snap.firefox.geckodriver.bin
/var/lib/snapd/seccomp/bpf/snap.firefox.geckodriver.src
/run/udev/tags/snap_firefox_geckodriver
$ which geckodriver
/snap/bin/geckodriver
/snap/bin/geckodriver
links to /snap/bin/firefox.geckodriver
which links to /usr/bin/snap
. I don't know how it proceeds from there.
Would you mind doing me a favor and test a non-snap packaged geckodriver and Firefox? I only want to be sure that this combination still works. Thanks!
This works:
PATH
) which in turn starts the snap-provided Firefox. The output is all in English.service = webdriver.firefox.service.Service("…/path/to/geckodriver", log_path=".geckodriver.log")
), the newly installed Firefox (that precedes the snap-Firefox in PATH
) is used. The output is in German.Ok, so it's indeed snap related. Could you also please check how it works when you use the non-snap packaged geckodriver but the Firefox binary from the Snap package? Note that you would have to pass the --profile-root
argument to geckodriver so it creates the Firefox profile at a Snap accessible location in your home directly and not under /tmp
.
I'm asking because I would like to know where exactly the language information is lost. Thanks!
Hmmm. I have a bit of trouble confirming what geckodriver gets actually loaded. Is there a way to confirm this?
In the context of the testcase above, and with the custom Firefox installed alongside the snap Firefox, please consider this setupcode. It is essentially the same as above, with comments added:
options = webdriver.firefox.options.Options()
service = webdriver.firefox.service.Service(
# executable_path="?????",
# service_args=["--profile-root", "/home/carsten/tmp"],
log_path=".geckodriver.log",
)
# binary = webdriver.firefox.firefox_binary.FirefoxBinary("/snap/bin/firefox")
# cls.browser = webdriver.Firefox(firefox_binary=binary, options=options, service=service)
cls.browser = webdriver.Firefox(options=options, service=service)
This is the original setup code with which the snap geckodriver and the snap Firefox is used. The output of about:support
is in English. It appears that the profile is in /tmp/
where the snap-Firefox cannot access it:
Now if I comment in the executable_path=…
line, even with the obviously wrong path ("?????"
), then the custom(?) geckodriver and the custom Firefox is used and the output is in German. (Note that the about:support
page confirms which Firefox binary is used, but I cannot be sure what geckodriver is used!)
Finally, switching explicitly back to the snap-Firefox:
options = webdriver.firefox.options.Options()
service = webdriver.firefox.service.Service(
executable_path="?????",
service_args=["--profile-root", "/home/carsten/tmp"],
log_path=".geckodriver.log",
)
binary = webdriver.firefox.firefox_binary.FirefoxBinary("/snap/bin/firefox")
cls.browser = webdriver.Firefox(firefox_binary=binary, options=options, service=service)
# cls.browser = webdriver.Firefox(options=options, service=service)
yields:
@carstenfuchs sorry for the long delay in my response. But I somehow missed your reply.
Ok, so this all is related to the snap packages for Firefox and geckodriver then. What's interesting is that it also happens when both binaries run from within the same snap, because that's how they are packaged.
Could you please check by running both geckodriver and Firefox from snap if the preferences that you set for localization are set when querying for those in about:config
?
Hi. I have met the same problem recently. Have you solved this?
System
Testcase
Trace-level log
Please see attachment: geckodriver.log
Description
I recently upgraded from Ubuntu 20.04 LTS to Ubuntu 22.04 LTS, where Firefox is installed as a
snap
package. My system language and locale is german, and under Ubuntu 20.04 LTS, the above script had the "about:support" page displayed in german language. This used to work without the two linesoptions.set_preference(…)
.Now with Ubuntu 22.04 LTS, the "about:support" page is always in english. I tried adding the
options.set_preference(…)
lines, but they make no difference.What is the proper way please to set the language and locale so that "about:support" and similar pages are displayed in the system default language?