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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[馃悰 Bug]: Contained Firefox can't be used on MacOS #10686

Closed
bogdancondurache opened this issue May 24, 2022 · 10 comments 路 Fixed by #10818
Closed

[馃悰 Bug]: Contained Firefox can't be used on MacOS #10686

bogdancondurache opened this issue May 24, 2022 · 10 comments 路 Fixed by #10818

Comments

@bogdancondurache
Copy link
Contributor

What happened?

For the project https://github.com/robocorp/rpaframework/ we're installing an isolated Firefox and adding that to the path. But because as seen here

if self.platform == "darwin": # small darwin due to lower() in self.platform
the path for MacOS is hardcoded and not searched for in $PATH, Selenium will never find and use that version.

How can we reproduce the issue?

Install Firefox on MacOS in a different path. Add it to the $PATH global variable and try to use Selenium against it. Selenium will fail, not being able to find Firefox.

Relevant log output

SessionNotCreatedException: Message: Expected browser binary location, but unable to find binary

Operating System

MacOS Monterey 12.3

Selenium version

3.141.0 (but based on the code seems like it should be on all versions)

What are the browser(s) and version(s) where you see this issue?

Firefox 98, 99 and 100

What are the browser driver(s) and version(s) where you see this issue?

GeckoDriver 0.30.0

Are you using Selenium Grid?

No response

@github-actions
Copy link

@bogdancondurache, thank you for creating this issue. We will troubleshoot it as soon as we can.


Info for maintainers

Triage this issue by using labels.

If information is missing, add a helpful comment and then I-issue-template label.

If the issue is a question, add the I-question label.

If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.

If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C), add the applicable G-* label, and it will provide the correct link and auto-close the issue.

After troubleshooting the issue, please add the R-awaiting answer label.

Thank you!

@diemol
Copy link
Member

diemol commented Jun 8, 2022

You can always provide the path, if not provided, then the location you mention will be used.

- firefox_path - Path to the Firefox executable. By default, it will be detected from the standard locations.

@bogdancondurache
Copy link
Contributor Author

@diemol Whilst I agree with you, I still think this is a bug. Why? Because some apps will be able only to setup the system properly (proper env vars, proper values and order of $PATH and so on) and not change the firefox_path value. Also, based on the docs you mentioned, by default it should be detected from the standard locations, which is clearly not the case because it is hardcoded. Hardcoding a path instead of using the usual means of finding an executable that everyone does, sounds like a bug. Specially when it's done just for MacOS.

@diemol
Copy link
Member

diemol commented Jun 8, 2022

Even if we rework the logic and follow your comments, or if we simply remove the path for macOS, GeckoDriver still will use this path as they know better the default locations.

Also, which are these ones?

by default it should be detected from the standard locations

@bogdancondurache
Copy link
Contributor Author

Even if we rework the logic and follow your comments, or if we simply remove the path for macOS, GeckoDriver still will use this path as they know better the default locations.

I'm not sure the problem is in GeckoDriver. This works well on Windows and Linux because (I assume) Gecko calculates the paths properly.

Also, which are these ones?

by default it should be detected from the standard locations

Usually the convention is to take each folder from $PATH in order and try to use the binary from there, that's why the order is important. From what I see, this is done by Selenium on Linux using the which method here:

I think this should be the best approach for MacOS as well, if the binary couldn't be found in the path currently hardcoded:

start_cmd = "/Applications/Firefox.app/Contents/MacOS/firefox-bin"

@diemol
Copy link
Member

diemol commented Jun 8, 2022

Sounds good, would you like to send us a PR? Probably @symonk and @AutomatedTester can help us to review.

@symonk
Copy link
Member

symonk commented Jun 18, 2022

Most certainly a pull request would be useful, I'm not on my mac right now or I would investigate, we can which firefox perhaps to derive start path if firefox is available on path but I have no idea if thats normal on OSX.

@diemol
Copy link
Member

diemol commented Jun 20, 2022

@bogdancondurache are you interested in sending a PR?

bogdancondurache added a commit to bogdancondurache/selenium that referenced this issue Jun 27, 2022
The Firefox binary under Mac OS was using a hardcoded path. This was
failing when trying to manipulate PATH env var to use firefox from a
different location or if Firefox was installed in a different place.

Fixes SeleniumHQ#10686
@bogdancondurache
Copy link
Contributor Author

@diemol @symonk I was on vacation, here is the PR I think will fix this: #10818

bogdancondurache added a commit to bogdancondurache/selenium that referenced this issue Jun 27, 2022
The Firefox binary under Mac OS was using a hardcoded path. This was
failing when trying to manipulate PATH env var to use firefox from a
different location or if Firefox was installed in a different place.

Fixes SeleniumHQ#10686
diemol added a commit that referenced this issue Jun 29, 2022
The Firefox binary under Mac OS was using a hardcoded path. This was
failing when trying to manipulate PATH env var to use firefox from a
different location or if Firefox was installed in a different place.

Fixes #10686

Co-authored-by: Simon K <jackofspaces@gmail.com>
Co-authored-by: Diego Molina <diemol@users.noreply.github.com>
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked and limited conversation to collaborators Jul 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants