ByteXenon / undetected_geckodriver

A custom Firefox Selenium-based WebDriver. Passes all bot mitigation systems
https://pypi.org/project/undetected-geckodriver/
MIT License
12 stars 1 forks source link

Added function to improve platform compatibility #2

Closed rjhampo closed 4 days ago

rjhampo commented 6 days ago

Platform

Operating System: Windows 11 Python Version: 3.12.7 Selenium Version: 4.25.0

Summary

I added a function _get_platform_dependent_params to make the package compatible with other platforms. When I first tried this package, I encountered errors coming from get_firefox_installation_path, get_undetected_firefox_path, patch_libxul_file, and the Firefox class constructor. The errors stem from hard-coded strings referring to Firefox in the Linux OS. The function that I added will help to at least put all the hard-coded paths in one place and adapt values based on the user platform.

I think this also fixes #1 although I wasn't able to test it out in MacOS. The changes should be minimal if it still doesn't work in it.

Aside from this, I also made a minor change in the constants in which the Firefox path key in "windows" is changed to "win32".

ByteXenon commented 5 days ago

The changes look pretty good to me!

I will test this on a Windows machine, but I am unable to test on macOS as I do not have access to a macOS device, and emulating it is quite ... problematic.

Thanks for contributing to this project, I will merge it as soon as I am able to test it on Windows

vochanhtin139 commented 1 day ago

I have just re-run on my Mac, it logged "FileNotFoundError: Could not find libxul.dylib (What the hell?!)"

rjhampo commented 1 day ago

If possible, could you specify the location of this file within your Firefox installation? A quick search tells me that the file is in "/Applications/Firefox.app/Contents/MacOS". However, I'm not familiar with Mac OS, hence I'm not sure if the path is correct or not

vochanhtin139 commented 1 day ago
Screenshot 2024-10-26 at 16 34 41

There's no file named "libxul.dylib" in "/Applications/Firefox.app/Contents/MacOS"

rjhampo commented 1 day ago

Okay, got it! I'll try to research more about this. It may take a while though since I don't have direct access to a Mac.