roniemartinez / browsers

Python library for detecting and launching browsers
MIT License
26 stars 2 forks source link

feature request: freebsd12 support #25

Open larham opened 2 years ago

larham commented 2 years ago

attempting to run python with selenium + webdriver-setup (for chrome or firefox) on a shared server at a hosting provider (pair.com)

2022-07-06 23:47:24,133 INFO 'freebsd12' is currently not supported. Please open an issue or a PR at 'https://github.com/roniemartinez/browsers'

browser = get_webdriver_for("firefox", options=options)
File "github/losebot/.venv/lib/python3.7/site-packages/webdriver_setup-1.1.0-py3.7.egg/webdriver_setup/get_webdriver.py", line 22, in get_webdriver_for
driver = FirefoxDriver(**kwargs)
File "github/losebot/.venv/lib/python3.7/site-packages/webdriver_setup-1.1.0-py3.7.egg/webdriver_setup/firefox.py", line 11, in __init__
super().__init__(**kwargs)
File "github/losebot/.venv/lib/python3.7/site-packages/webdriver_setup-1.1.0-py3.7.egg/webdriver_setup/driver.py", line 6, in __init__
self.driver = self.create_driver(**kwargs)
File "github/losebot/.venv/lib/python3.7/site-packages/webdriver_setup-1.1.0-py3.7.egg/webdriver_setup/firefox.py", line 24, in create_driver
driver_path = GeckoDriverManager(cache_valid_range=cache_timeout).install()
File "github/losebot/.venv/lib/python3.7/site-packages/webdriver_manager-3.8.0-py3.7.egg/webdriver_manager/firefox.py", line 36, in install
driver_path = self._get_driver_path(self.driver)
File "github/losebot/.venv/lib/python3.7/site-packages/webdriver_manager-3.8.0-py3.7.egg/webdriver_manager/core/manager.py", line 29, in _get_driver_path
binary_path = self.driver_cache.find_driver(driver)
File "github/losebot/.venv/lib/python3.7/site-packages/webdriver_manager-3.8.0-py3.7.egg/webdriver_manager/core/driver_cache.py", line 95, in find_driver
driver_version = driver.get_version()
File "github/losebot/.venv/lib/python3.7/site-packages/webdriver_manager-3.8.0-py3.7.egg/webdriver_manager/core/driver.py", line 44, in get_version
if self._version == "latest"
File "github/losebot/.venv/lib/python3.7/site-packages/webdriver_manager-3.8.0-py3.7.egg/webdriver_manager/drivers/firefox.py", line 29, in get_latest_release_version
self.browser_version = get_browser_version_from_os("firefox")
File "github/losebot/.venv/lib/python3.7/site-packages/webdriver_manager-3.8.0-py3.7.egg/webdriver_manager/core/utils.py", line 200, in get_browser_version_from_os
}[browser_type][os_name()]
roniemartinez commented 2 years ago

Thanks for opening an issue. I have not worked on FreeBSD but are Desktop Entries (.desktop) supported?

larham commented 2 years ago

I found a document about a tool for installing .desktop on freebsd Is that related?

roniemartinez commented 2 years ago

What I mean is that if FreeBSD uses the same method as Linux does?

In Linux, whenever you install an application, it creates a .desktop file (e.g. firefox.desktop) which contains the app information including where the executables are located. This only applies to desktop Linux.

https://github.com/roniemartinez/browsers/blob/c78c74908259e6f8fe7fd9c759d597e4097b1b83/browsers/linux.py#L9-L11

larham commented 2 years ago

Sorry, I'm ignorant of desktop mode on both linux and freebsd.

Is there a small investigative step I can perform to help you understand the answer to your question?

roniemartinez commented 2 years ago

That's alright. Can you check if any of these directories contain .desktop files?

https://github.com/roniemartinez/browsers/blob/c78c74908259e6f8fe7fd9c759d597e4097b1b83/browsers/linux.py#L23-L28

larham commented 2 years ago

apparently not:

ls: ~/.local/share/applications: No such file or directory
ls: /usr/share/applications: No such file or directory
ls: /var/lib/snapd/desktop/applications: No such file or directory

as a shared server at a hosting company, I'd expect server-only style, headless executables

roniemartinez commented 2 years ago

Thanks! I will have to try FreeBSD to add support.