Using Chrome with extensions in WebDriver-IO

Viewed 15

I'm quite new with WebdriverIO. What I'm trying to do is to launch Chrome with the Ublock Origin adblocker extension. From what I understood, in the constructor I added this:

const { remote } = require('webdriverio');
const fs = require('fs');
(async () => {
    const browser = await remote({
        logLevel: 'silent',
        capabilities: {
            browserName: 'chrome',
            'goog:chromeOptions': {
                extensions: [
                    fs.readFileSync('d:/extensions/extension_1_44_2_0.crx').toString('base64')
                ]
            }
        }
    })

Where the CRX file is the ublock origin extension. But it's not launching Chrome with ublock when I tried. And noticed in the console logs:

2022-09-18T12:04:21.573Z INFO devtools: Launch Google Chrome with flags: --enable-automation --disable-popup-blocking --disable-extensions --disable-background-networking --disable-background-timer-throttling --disable-backgrounding-occluded-windows --disable-sync --metrics-recording-only --disable-default-apps --mute-audio --no-first-run --no-default-browser-check --disable-hang-monitor --disable-prompt-on-repost --disable-client-side-phishing-detection --password-store=basic --use-mock-keychain --disable-component-extensions-with-background-pages --disable-breakpad --disable-dev-shm-usage --disable-ipc-flooding-protection --disable-renderer-backgrounding --force-fieldtrials=*BackgroundTracing/default/ --enable-features=NetworkService,NetworkServiceInProcess --disable-features=site-per-process,TranslateUI,BlinkGenPropertyTrees --window-position=0,0 --window-size=1200,900

It launched Chrome with the --disable-extensions and --disable-popup-blocking parameters. I tried to modify the constant.js file and switching to enable-extensions and enable-popup-blocking, to no avail either. What should I do to make it work? Thank you in advance.

0 Answers
Related