Use external chromedriver server?
Closed this issue · 8 comments
I have trouble syncing the versions of chromedriver and google-chrome via homebrew. Now I'm trying to work with docker compose to setup a container with chrome and chromedriver. That would also help in my CI setup.
In order to make this setup work, I need to use an standalone running chromedriver (the one within the docker image) and don't want wallaby to manage the chromedriver server. So I have to specify the used host and port for the chromedriver server.
Any idea how I could achieve that?
I don't think it's currently possible, but can probably be made possible. The selenium driver allows this.
The one thing you'd have to worry about tho is concurrency, its pretty easy to overload a single chromedriver instance, which is why Wallaby starts a pool of them.
With that docker-compose setup, might be easy to start a few and then pass the driver all the URLs and basically have the same pooling mechanism over the URL rather than the chromedriver instances.
Ah good point!
I wonder, how do other libraries like wallaby handle this issue? I had never version issues with rubys capybara for example 🤔
It's been 4+ years since I've used capybara but as far as I know it only runs one test at a time
Good point. I wonder, what the best solution might be. The core problem is that it is difficult to keep chrome and chromedriver in the same version. Especially when there are bugs in the package management of the OS or chrome update package is available before chromedriver update package and so on.
My first idea was to use a docker container, but there is no official chromedriver image and concurrency might be an issue as you pointed out, so this doesn't feel very clean.
Another approach would be to make wallaby manage it's on chromedriver installation like this:
- Check wether chrome is installed (an abort if not)
- Check wether chromedriver is installed and version is the same (if yes: fine)
- If not, automatically download the chromedriver binary matching the installed chrome version and use this binary
How do you feel about this idea, Mitchell?
are you having trouble geting the right version locally or in CI?
if its local, I think my suggestion would be to write a script that does something similar to what you described, get version of installed chrome, then download the correct chromedriver version
I have this problem locally. For GitLab CI, I will build a custom docker image with (hopefully) correct chrome and chromedriver version preinstalled.
A local script would be a workaround, yes. But I think others may have this kind of issue too and it would be very comfortable when wallaby handles this on it's own :)
A better option actually is to use the puppeteer/browsers cli that allows you to install any and exact versions of Firefox and Chrome
You could easily configure wallaby to use chrome and chromedriver from a specific path (a gitignored directory in your project dir, or a global cache dir) and then install them with that.
I think having Wallaby manage and install the browser/webdriver is a whole can of worms that would take a lot of thought, so if there are easy ways to accomplish something similar then I'd rather do that first.
If we were to pursue a wallaby-managed solution, i think I'd rather build something akin to the tailwind/esbuild libraries.
I've managed to fix the issue with homebrew. Also browsers-api is a nice solution, which I didn't know :) thanks for your help. I will close this issue for now as long as I'm the only one who has this kind of problem and this is hopefully solved right now.
Thanks for your time and work on this project, really appreciate :)