Skip to content

Commit 02297e8

Browse files
committed
[js] Code sample for installAddon and uninstallAddon for firefox
1 parent 45f9c29 commit 02297e8

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

examples/javascript/test/browser/firefoxSpecificFunctionalities.js

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
const {Browser} = require('selenium-webdriver');
1+
const {Browser, By} = require('selenium-webdriver');
22
const Firefox = require('selenium-webdriver/firefox');
33
const options = new Firefox.Options();
44
const path = require('path');
55
const {suite} = require("selenium-webdriver/testing");
6+
const assert = require("assert");
67

78

89
suite(function (env) {
@@ -19,11 +20,14 @@ describe('Should be able to Test Command line arguments', function () {
1920
it('Should be able to add extension', async function () {
2021

2122
const xpiPath = path.resolve('./test/resources/extensions/selenium-example.xpi')
22-
let driver = await env.builder()
23-
.setFirefoxOptions(options.addExtensions(xpiPath))
24-
.build();
23+
let driver = await env.builder().build();
24+
let id = await driver.installAddon(xpiPath);
25+
await driver.uninstallAddon(id);
26+
2527

2628
await driver.get('https://www.selenium.dev/selenium/web/blank.html');
29+
const ele = await driver.findElements(By.id("webextensions-selenium-example"));
30+
assert.equal(ele.length, 0);
2731
await driver.quit();
2832
});
2933
});

0 commit comments

Comments
 (0)