[mozversion] Parse binary version fails for other Firefox distributions
Categories
(Testing :: Mozbase Rust, enhancement, P5)
Tracking
(firefox121 fixed)
Tracking | Status | |
---|---|---|
firefox121 | --- | fixed |
People
(Reporter: rafiibrahim8, Assigned: rzvncj, Mentored)
References
Details
(Whiteboard: [lang=rust][webdriver:m9][webdriver:external])
Attachments
(1 file)
Steps to reproduce:
I was trying to automate Librewolf (a Firefox-based browser) on Linux (Arch).
Here is the code:
from selenium import webdriver
from selenium.webdriver.firefox.service import Service as FirefoxService
from webdriver_manager.firefox import GeckoDriverManager
options = webdriver.FirefoxOptions()
options.binary_location = '/usr/bin/librewolf'
driver = webdriver.Firefox(service=FirefoxService(GeckoDriverManager().install()), options=options)
Actual results:
The geckodriver returned an Invalid Argument Error: binary is not a Firefox executable.
Upon digging a little bit. I found that geckodriver is checking the browser version using regex: Mozilla Firefox[[:space:]]+(?P<version>.+)
. But not all Firefox-based browser version starts with Mozilla Firefox. For example, here is librewolf's version string: LibreWolf Firefox 113.0.2-1.
I've also tested it on Windows. There it works fine. Apparently, geckodrver was reading from application.ini
file in windows.
Expected results:
Should work on any Firefox-based browser.
Thanks for the report. The underlying issue here is in the mozversion
crate and can be found at:
https://searchfox.org/mozilla-central/rev/346a76bee7dc0e60f8f2ae9690785e818bd05cec/testing/mozbase/rust/mozversion/src/lib.rs#258-260
Supporting all kinds of distributions might not be possible given that they might have a completely different name or even versioning schema. But maybe we could simply check for Firefox
being present with a version number following.
Reporter | ||
Comment 2•2 years ago
|
||
Yeah, we can check for Firefox <Version Number>
. It won't cover all the other browsers. But it will enable some browsers to automate.
FYI this is not a priority for us at the moment, but we are happy to accept patches, and I'm happy to mentor you in case you want to get it fixed.
Alternatively you could download a recent Firefox from the Mozilla website, or what should also work do not pass in a browserVersion
capability so that we are not trying to validate / match the version number.
Assignee | ||
Comment 4•2 years ago
|
||
Otherwise input such as "LibreWolf Firefox 113.0.2-1" will not
work when we try to extract the version number.
Updated•2 years ago
|
Updated•2 years ago
|
Comment 6•2 years ago
|
||
bugherder |
Razvan, thanks a lot for the patch. In case you are interested to contribute and learn more please let us know. We are happy to discuss options as well on Matrix (#webdriver channel).
Description
•