I would like to know how i can add an unpacked extension that i have on my computeur to my chrome webdriver using this : https://seleniumhq.github.io/selenium/docs/api/javascript/module/selenium-webdriver/chrome_exports_Options.html#addExtensions I don't really understand what im supposed to do with it.. Thanks in advance to everybody that will help me =) P.S : Im using these node packages : selenium-webdriver, fs
import {Builder, Capabilities} from 'selenium-webdriver';
import {Options, ServiceBuilder, setDefaultService} from 'selenium-webdriver/chrome';
import * as chromedriver from 'chromedriver';
import * as path from 'path';
import * as fs from 'fs';
const encodeExt = file => {
const stream = fs.readFileSync(path.resolve(file));
return Buffer.from(stream).toString('base64');
};
const service = new ServiceBuilder(chromedriver.path).build();
setDefaultService(service);
const driver = new Builder()
.withCapabilities(Capabilities.chrome())
.setChromeOptions(new Options()
.addExtensions(encodeExt('./3.5.2_0.crx'))) <-----+
.build(); |
|
|
this line here! ----------------------------
And this is how to download the .crx file: https://www.maketecheasier.com/download-save-chrome-extension/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With