Installing Chrome browser on Mac m1 arm64

2.3k Views Asked by At

I am using codeception with Cakephp4 for testing. I tried to use chromium browser instead of chrome but I get this error:

System info: host: 'f1c4f5d6ba86', ip: '172.28.0.2', os.name: 'Linux', os.arch: 'aarch64', os.version: '5.15.49-linuxkit', java.version: '11.0.20.1' Driver info: driver.version: unknown

Below is the part for installing chrome in dockerfile:

# Install chrome web driver
RUN cd etc/ && wget https://selenium-release.storage.googleapis.com/3.13/selenium-server-standalone-3.13.0.jar
RUN wget https://chromedriver.storage.googleapis.com/2.41/chromedriver_linux64.zip
RUN unzip chromedriver_linux64.zip && rm chromedriver_linux64.zip && mv chromedriver /usr/bin/chromedriver
RUN chmod +x /usr/bin/chromedriver

RUN wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
RUN dpkg -i google-chrome*.deb
RUN rm google-chrome*.deb

WORKDIR $APP_HOME
COPY . $APP_HOME

# Copy cron job we want to run and start cron service
RUN crontab etc/test-cron

# Run selenium
RUN java -Dwebdriver.chrome.driver=/usr/bin/chromedriver -jar etc/selenium-server-standalone-3.13.0.jar -port 9515 &

# Install
RUN composer install -n

This is my acceptance.suite.yml:

actor: AcceptanceTester
modules:
  enabled:
    - WebDriver:
        url: http://foo.bar
        port: 9515 # This should be the port for the Chromium WebDriver
        browser: chrome # Use Chromium
        capabilities:
          "goog:chromeOptions":
            args: ["--headless", "--disable-gpu", "--no-sandbox", "--disable-dev-shm-usage"]
        wait: 15
    - \Helper\Acceptance
    - Asserts
    - \Helper\AcceptanceHelper

I tried to use Chromium browser but get unknown driver error

1

There are 1 best solutions below

0
SarkarRipon On

Since you did not provide the exact error message so I am guessing the error is coming because your chrome driver is not running.

You have mentioned the port 9515 which is fine. Now you can either start chromedriver in a seperate terminal tab by running

chromedriver

Or you can simply modify your code like below

actor: AcceptanceTester
extensions:
    enabled:
        - Codeception\Extension\RunProcess:
              0: chromedriver --url-base=wd/hub
              sleep: 1
              wait: 15
modules:
    enabled:
        - WebDriver:
              url: http://foo.bar
              port: 9515 # This should be the port for the Chromium WebDriver
              browser: chrome # Use Chromium
              capabilities:
                  "goog:chromeOptions":
                      args: ["--headless", "--disable-gpu", "--no-sandbox", "--disable-dev-shm-usage"]
        - \Helper\Acceptance
        - Asserts
        - \Helper\AcceptanceHelper

This is totally a guess so, Let me know if your error message changes or got the solution. Thanks