seleniumbase / SeleniumBase

📊 Python's all-in-one framework for web crawling, scraping, testing, and reporting. Supports pytest. UC Mode provides stealth. Includes many tools.
https://seleniumbase.io
MIT License
5.3k stars 973 forks source link

Different Apple Silicon Macs using different versions of Chrome (chromedriver?) #2922

Closed gottogethelp closed 3 months ago

gottogethelp commented 3 months ago

I have selenium base 4.28.5 installed on two M1 Macs both with the latest version of Sonoma.

When running the following code:

from seleniumbase import Driver

driver = Driver()

driver.get("https://www.scrapethissite.com/pages/")

The same code opens a different version of Chrome on the two machines. One has "Version 126.0.6478.127 (Official Build) (arm64)" and the other has "Version 126.0.6478.127 (Official Build) (x86_64 translated)". The latter runs much slower when scraping multiple pages so I've been trying to work out how to get seleniumbase to use the native version.

If I open the Chrome application on the 'translated Chrome' Mac then it opens the arm-64 version so that's definitely installed. I figure I need to try and force seleniumbase to use the arm-64 chromedriver? I've tried downloading the arm-64 chromedriver and then running:

from seleniumbase import Driver

driver = Driver(binary_location="/Users/myusername/Downloads/chromedriver-mac-arm64/chromedriver")

driver.get("https://www.scrapethissite.com/pages/")

But seleniumbase still opens the translated Chrome.

Any ideas on where I might be going wrong?

mdmintz commented 3 months ago

binary_location is the location of the browser, not the driver. The driver location will always be seleniumbase/drivers/ from the install folder, unless there's a matching driver already on the System PATH.

You may need to install Rosetta 2 on your Mac to fix CPU issues:

softwareupdate --install-rosetta
gottogethelp commented 3 months ago

Thanks Michael.

binary_location is the location of the browser, not the driver. The driver location will always be seleniumbase/drivers/ from the install folder, unless there's a matching driver already on the System PATH.

I've gone through and cleaned up my PATH and also deleted every single instance of chromedriver on the 'x86_64 translated' machine except the arm-64 version in the selenium base folder. I've even manually replaced this with a copy I've downloaded just to ensure it is the arm-64 version.

Still getting the x86_64 translated version of Chrome when I run the code from my original post.

You may need to install Rosetta 2 on your Mac to fix CPU issues:

I appreciate I can play around with Rosetta to help run things better but I'd want to run the native version if at all possible. I don't understand how I can get the arm-64 version on one machine and not the other!!

gottogethelp commented 3 months ago

Ok think I've found the issue. Solution here.