mmsood99
mmsood99

Reputation: 1

Using chromium webdriver under selenium on ubuntu ARM64

I am running an ubuntu 22.04 ARM64 UTM virtual machine on an Apple M1 mini. I am trying to get chromedriver running via python on this ARM64 architecture using this code snippet:

from selenium import webdriver
from selenium.webdriver.chrome.options import Options

def myFunc(URL):
    webDriver = None

    try:
        chrome_driver_path = '/usr/bin/chromedriver'
        chromeOptions = Options()
        chromeOptions.add_argument("--headless=new")
        chromeOptions.add_argument("--start-maximized")
        chromeOptions.binary_location = chrome_driver_path
        webDriver = webdriver.Chrome(options=chromeOptions)  <----- This line fails
        webDriver.get(URL)

        Do something....

    except Exception as e:
        print(e)
        if webDriver != None:
            webDriver.close()
            webDriver = None

    return webDriver

I installed chromium and chromedriver using: sudo apt-get install chromium-chromedriver

and the versions of chromium and chromedriver are: Chromium 122.0.6261.94 snap ChromeDriver 122.0.6261.94 (880dbf29479c6152d5e4f08dfd3a96b30f919e56-refs/branch-heads/6261@{#960})

  1. I have verified I can run the chromedriver at /usr/bin/chromedriver
  2. I have tried not supplying the binary path to the chromedriver

The code throws an exception at the indicate line: 'Unable to obtain driver for chrome using Selenium Manager.; For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors/driver_location

Upvotes: 0

Views: 2215

Answers (1)

zzpzaf
zzpzaf

Reputation: 158

You can get the chromium from the XTRADEB, (an unofficial Ubuntu initiative aiming to provide the latest software and game packages). For this, you first must get the repositories via PPA. You can do so using the command: add-apt-repository ppa:xtradeb/apps -y. (If the add-apt-repository is missed, it can be installed via apt-get install software-properties-common). Then you can install chromium via apt-get install chromium and then you can also install the chromium-driver via apt-get install chromium-driver My answer here (for selenium official support to arm64) might be also useful for you.

Upvotes: 0

Related Questions