Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Chromium, /usr/bin/chromedriver on Linux arm64 #76

Merged
merged 1 commit into from
Dec 24, 2023

Conversation

mbland
Copy link
Owner

@mbland mbland commented Dec 24, 2023

The project now completely builds and passes all tests on Linux arm64 using Chromium.

The following is adapted from the comment block for the new WebApplicationTest.getChromeDriver(). Including the information here to make sure it's more accessible to anyone who could use it.


If /usr/bin/chromium if present, the test will use this browser and set the ChromeDriver instance to /usr/bin/chromedriver. This is because Google Chrome isn't yet available for arm64 Linux, and WebDriver doesn't download the correct driver, either:

It also won't work with a snap-installed version of Chromium. At the time of writing, I installed Chromium by upgrading to Ubuntu 23.10 and following the following advice to install Chromium from Debian:

For future reference, this is how to install the non-snap version of Firefox from Mozilla:


Also of note: Upgrading to Ubuntu 23.10 will not automatically upgrade any Docker packages installed via:

The effect is that the Docker container will run, but nothing can connect to its ports. This will cause the WebDriver tests to hang (until we move away from using Docker and running Tomcat directly).

To fix it:

  sudo apt remove docker-ce docker-ce-cli containerd.io \
    docker-buildx-plugin docker-compose-plugin

  # Get the value of VERSION_CODENAME from /etc/os-release or
  # `lsb_release -cs`. Update the codename in the following file with
  # this value. Going from Ubuntu 22.04 to 23.10, this will replace
  # "jammy" with "mantic".
  sudo vim /etc/apt/sources.list.d/docker.list

  sudo apt install docker-ce docker-ce-cli containerd.io \
    docker-buildx-plugin docker-compose-plugin

The ChromeDriverService.Builder().usingDriverExecutable(driverPath) method of setting /usr/bin/chromedriver came from:

The project now completely builds and passes all tests on Linux arm64
using Chromium.

The following is adapted from the comment block for the new
WebApplicationTest.getChromeDriver(). Including the information here to
make sure it's more accessible to anyone who could use it.

---

If /usr/bin/chromium if present, the test will use this browser and set
the ChromeDriver instance to /usr/bin/chromedriver. This is because
Google Chrome isn't yet available for arm64 Linux, and WebDriver doesn't
download the correct driver, either:

- https://developer.chrome.com/blog/chrome-for-testing
- https://googlechromelabs.github.io/chrome-for-testing/
- https://github.com/GoogleChromeLabs/chrome-for-testing#json-api-endpoints
- SeleniumHQ/selenium#11357 (comment)

It also won't work with a snap-installed version of Chromium. At the
time of writing, I installed Chromium by upgrading to Ubuntu 23.10 and
following the following advice to install Chromium from Debian:

- https://askubuntu.com/questions/1179273/how-to-remove-snap-completely-without-losing-the-chromium-browser/1206502#1206502

For future reference, this is how to install the non-snap version of
Firefox from Mozilla:

- https://www.omgubuntu.co.uk/2022/04/how-to-install-firefox-deb-apt-ubuntu-22-04

---

Also of note: Upgrading to Ubuntu 23.10 will not automatically upgrade
any Docker packages installed via:

- https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository

The effect is that the Docker container will run, but nothing can
connect to its ports. This will cause the WebDriver tests to hang (until
we move away from using Docker and running Tomcat directly).

To fix it:

```sh
  sudo apt remove docker-ce docker-ce-cli containerd.io \
    docker-buildx-plugin docker-compose-plugin

  # Get the value of VERSION_CODENAME from /etc/os-release or
  # `lsb_release -cs`. Update the codename in the following file with
  # this value. Going from Ubuntu 22.04 to 23.10, this will replace
  # "jammy" with "mantic".
  sudo vim /etc/apt/sources.list.d/docker.list

  sudo apt install docker-ce docker-ce-cli containerd.io \
    docker-buildx-plugin docker-compose-plugin
```

---

The ChromeDriverService.Builder().usingDriverExecutable(driverPath)
method of setting /usr/bin/chromedriver came from:

- https://www.selenium.dev/documentation/webdriver/drivers/service/#driver-location
- https://github.com/SeleniumHQ/seleniumhq.github.io/blob/trunk/examples/java/src/test/java/dev/selenium/drivers/ServiceTest.java#L25-L26
@mbland mbland self-assigned this Dec 24, 2023
@mbland mbland merged commit 3ea32f7 into main Dec 24, 2023
3 checks passed
@mbland mbland deleted the use-chromium-on-linux-arm64 branch December 24, 2023 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant