Notes
Comparing WebdriverIO Firefox vs Chrome
Chrome recently started releasing arm64 linux builds which meant that my ubuntu-on-m1-mac can run webdriverio (wdio) builds on both firefox and chrome (it was previously stuck doing only firefox builds).
I therefore compared build speed of codemancer on firefox versus chrome.
wdio.conf.ts Configuration
Firefox:
capabilities: [{
maxInstances: 5,
browserName: 'firefox',
'moz:firefoxOptions': {
args: ['-headless'],
},
acceptInsecureCerts: true,
}],
Chrome:
capabilities: [{
maxInstances: 5,
browserName: 'chrome',
'goog:chromeOptions': {
args: ['--headless=new', '--no-sandbox', '--disable-dev-shm-usage', '--disable-gpu'],
},
acceptInsecureCerts: true,
}],
For Arm architectures, the most recent version of wdio still depends on
@puppeteer/browsers at ^2.2.0 which doesn’t correctly fetch Chrome’s Arm builds.
Therefore, these additional configs need to be added to wdio.conf.ts:
// Set these environment variables to manually-downloaded chrome executables
// For the satantime/puppeteer-node:26-trixie-slim docker images, use
// CHROME_BINARY=/usr/bin/chromium
// CHROMEDRIVER_BINARY=/usr/bin/chromedriver
const chromeBinary = process.env.CHROME_BINARY;
const chromedriverBinary = process.env.CHROMEDRIVER_BINARY;
// inside capabilities
'goog:chromeOptions': {
args: [/* ... */],
...(chromeBinary ? { binary: chromeBinary } : {}),
},
...(chromedriverBinary ? { 'wdio:chromedriverOptions': { binary: chromedriverBinary } } : {}),
Benchmarks
I benchmarked both browsers on codemancer unit tests over 30 iterations.
On Arm64, Chromium 151 against Firefox 155:
browser runs min median mean max
chrome 10 4934ms 6593ms 7143ms 10054ms
firefox 10 7055ms 11426ms 17360ms 50600ms
On x86_64, Chromium 152 against Firefox ESR 140:
browser runs min median mean max
chrome 10 4433ms 5265ms 6798ms 15222ms
firefox 10 6645ms 9119ms 18613ms 56509ms