Closed Bug 1836669 Opened 2 years ago Closed 2 years ago

[mozversion] Parse binary version fails for other Firefox distributions

Categories

(Testing :: Mozbase Rust, enhancement, P5)

Default
enhancement

Tracking

(firefox121 fixed)

RESOLVED FIXED
121 Branch
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.

Status: UNCONFIRMED → NEW
Component: geckodriver → Mozbase Rust
Ever confirmed: true
Summary: Geckodriver not working with other firefox based browser on linux → [mozversion] Parse binary version fails for other Firefox distributions

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.

Mentor: hskupin
Priority: -- → P5
Whiteboard: [lang=rust]

Otherwise input such as "LibreWolf Firefox 113.0.2-1" will not
work when we try to extract the version number.

Assignee: nobody → rzvncj
Status: NEW → ASSIGNED
Attachment #9357321 - Attachment description: Bug 1836669 - Check only for "Firefox <Version Number>" in parse_binary_version(). r?whimboo → Bug 1836669 - [geckodriver] Check only for "Firefox <Version Number>" in parse_binary_version().
Pushed by hskupin@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/bb87f8afbd7c [geckodriver] Check only for "Firefox <Version Number>" in parse_binary_version(). r=whimboo,webdriver-reviewers,jgraham
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 121 Branch

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).

Whiteboard: [lang=rust] → [lang=rust][webdriver:m9][webdriver:external]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: