Jump to content

Selenium/How-to/Run tests using a specific browser

From mediawiki.org

Sometimes you have to explicitly specify path to the browser. For example, if you are using Chromium or Chrome for Testing.

Environments

[edit]

This tip works if you're targeting:

wdio.conf.js

[edit]

Add binary to goog:chromeOptions in tests/selenium/wdio.conf.js.

tests/selenium/wdio.conf.js

exports.config = { ...config,
  capabilities: [ {
    browserName: 'chrome',
    'goog:chromeOptions': {
      binary: '/usr/bin/chromium'
    }
  } ],
};

In a Fresh container, Chromium is in /usr/bin/chromium. I have installed Chrome for Testing in /tmp/chrome/linux-127.0.6533.88/chrome-linux64/chrome.

On MacOs, Homebrew installed Chromium to /opt/homebrew/bin/chromium. I have installed Chrome for Testing to /Applications/chrome/mac_arm-127.0.6533.88/chrome-mac-arm64/Google Chrome for Testing.app/Contents/MacOS/Google Chrome for Testing.

Run Selenium tests

[edit]
npm run selenium-test

More information

[edit]