I use Selenium Webdriver in Python with chromedriver. The performance of chromedriver suddenly was abysmal.
On closer inspection I discovered that chromedrive has started the translated version of Chrome for the x86 architecture, even though I'm on Apple Silicon.
When I start Chrome directly (without Chromedriver) the correct version starts.
When I inspected Chrome with file
it turns out, that both architectures are available. The reason seems to be that Chrome now ships as a unified binary.
This issue only appears when chromedriver is used by Selenium from Python. When I start chromedriver manually, the correct version of Chrome is started:
$ ./chromedriver
and then start chrome by http request:
$ curl -X POST http://localhost:9515/session -d '{"capabilities": {"browserName": "chrome"}}'
I found a discussion claiming that it might be the version of Selenium, so I upgraded it to version 4.11.2. No effect. Someone else suggested upgrading Java. I did upgrade to jdk 20. Also no effect. Source of discussion.
The problem started with chromedriver version 113.
Does anyone have an idea what is going on? Please help, it is slooooowwwww
So it turns out I installed a version of Python for the x86_64
architecture. I use miniconda to create virtual environments and I probably created an environment, setting the architecture to x86_64.
I probably did it some time ago because a ML package that I am using wasn't available for arm64. I checked my architecture with
🤷 ❯ python -c 'import platform; print(platform.platform())'
macOS-13.4.1-x86_64-i386-64bit
So I created a new conda environment, without setting the architecture flag explicitly. This way it defaults to arm64:
🤷 ❯ conda create -n my_new_arm64_environment python=3.9.9
And checking with
🤷 ❯ python -c 'import platform; print(platform.platform())'
macOS-13.4.1-arm64-arm-64bit
Now chromedriver runs the correct version of Chrome 🎉
Hope that helps someone