Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .skipped-tests
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@
-//java/test/org/openqa/selenium/remote:RemoteWebDriverBuilderTest
-//java/test/org/openqa/selenium/remote:RemoteWebDriverScreenshotTest-remote
-//javascript/chrome-driver/...
-//javascript/selenium-webdriver:test-builder-test.js-chrome
-//javascript/selenium-webdriver:test-chrome-devtools-test.js-chrome
-//javascript/selenium-webdriver:test-firefox-options-test.js-firefox
-//rb/spec/integration/selenium/webdriver/chrome:service-chrome
-//rb/spec/integration/selenium/webdriver/chrome:service-chrome-remote
-//rb/spec/integration/selenium/webdriver/edge:service-edge
Expand Down
8 changes: 4 additions & 4 deletions common/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ js_library(

http_archive(
name = "linux_beta_firefox",
url = "https://ftp.mozilla.org/pub/firefox/releases/147.0b7/linux-x86_64/en-US/firefox-147.0b7.tar.xz",
sha256 = "23d88d89a3a4441c0bda56f93458acb4698f22aae1723409fcba5ea2cb6a86de",
url = "https://ftp.mozilla.org/pub/firefox/releases/147.0b8/linux-x86_64/en-US/firefox-147.0b8.tar.xz",
sha256 = "3ea7380cc380ab40845a02bc2c82ce6a47dbdc2e36ea970e489872fa4b058c30",
build_file_content = """
load("@aspect_rules_js//js:defs.bzl", "js_library")
package(default_visibility = ["//visibility:public"])
Expand All @@ -72,8 +72,8 @@ js_library(

dmg_archive(
name = "mac_beta_firefox",
url = "https://ftp.mozilla.org/pub/firefox/releases/147.0b7/mac/en-US/Firefox%20147.0b7.dmg",
sha256 = "e7f17f0416e0302b065aaa910071d43e84b1f569c7c225d21cadc23424d5ffc6",
url = "https://ftp.mozilla.org/pub/firefox/releases/147.0b8/mac/en-US/Firefox%20147.0b8.dmg",
sha256 = "4e9fcb29079a1f273aa9fe030d00eaedd2fad40f305ca01fa13f5dd37359b358",
build_file_content = """
load("@aspect_rules_js//js:defs.bzl", "js_library")
package(default_visibility = ["//visibility:public"])
Expand Down
54 changes: 17 additions & 37 deletions javascript/selenium-webdriver/lib/webdriver.js
Original file line number Diff line number Diff line change
Expand Up @@ -1380,20 +1380,12 @@ class WebDriver {
}
})

await connection.execute(
'Fetch.enable',
{
handleAuthRequests: true,
},
null,
)
await connection.execute(
'Network.setCacheDisabled',
{
cacheDisabled: true,
},
null,
)
await connection.send('Fetch.enable', {
handleAuthRequests: true,
})
await connection.send('Network.setCacheDisabled', {
cacheDisabled: true,
})
}

/**
Expand Down Expand Up @@ -1563,15 +1555,11 @@ class WebDriver {
connection = this._cdpConnection
}

await connection.execute('Page.enable', {}, null)
await connection.send('Page.enable', {})

await connection.execute(
'Runtime.evaluate',
{
expression: pinnedScript.creationScript(),
},
null,
)
await connection.send('Runtime.evaluate', {
expression: pinnedScript.creationScript(),
})

let result = await connection.send('Page.addScriptToEvaluateOnNewDocument', {
source: pinnedScript.creationScript(),
Expand All @@ -1597,23 +1585,15 @@ class WebDriver {
connection = this._cdpConnection
}

await connection.execute('Page.enable', {}, null)
await connection.send('Page.enable', {})

await connection.execute(
'Runtime.evaluate',
{
expression: script.removalScript(),
},
null,
)
await connection.send('Runtime.evaluate', {
expression: script.removalScript(),
})

await connection.execute(
'Page.removeScriptToEvaluateOnLoad',
{
identifier: script.scriptId,
},
null,
)
await connection.send('Page.removeScriptToEvaluateOnLoad', {
identifier: script.scriptId,
})

delete this.pinnedScripts_[script.handle]
}
Expand Down
2 changes: 1 addition & 1 deletion javascript/selenium-webdriver/test/builder_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ test.suite(function (env) {

it(env.browser.name, async function () {
let timeouts = { implicit: 0, pageLoad: 1000, script: 1000 }
driver = new Builder().setCapability('timeouts', timeouts).forBrowser(env.browser.name).build()
driver = env.builder().setCapability('timeouts', timeouts).build()

let caps = await getCaps(driver)
assert.deepEqual(caps.get('timeouts'), timeouts)
Expand Down
32 changes: 8 additions & 24 deletions javascript/selenium-webdriver/test/firefox/options_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ const { locate } = require('../../lib/test/resources')
const { until, By } = require('selenium-webdriver/index')

const EXT_XPI = locate('common/extensions/webextensions-selenium-example.xpi')
const WEBEXTENSION_EXTENSION_ID = '[email protected]'

suite(
function (env) {
Expand All @@ -43,16 +42,8 @@ suite(
})

describe('Options', function () {
let profileWithWebExtension
let profileWithUserPrefs

before(async function createProfileWithWebExtension() {
profileWithWebExtension = await io.tmpDir()
let extensionsDir = path.join(profileWithWebExtension, 'extensions')
await io.mkdir(extensionsDir)
await io.write(path.join(extensionsDir, WEBEXTENSION_EXTENSION_ID), await io.read(EXT_XPI))
})

before(async function createProfileWithUserPrefs() {
profileWithUserPrefs = await io.tmpDir()
await io.write(
Expand All @@ -71,16 +62,6 @@ suite(
await driver.get(Pages.echoPage)
await verifyUserAgentWasChanged()
})

it('use profile with extension', async function () {
let options = env.builder().getFirefoxOptions() || new firefox.Options()
options.setProfile(profileWithWebExtension)

driver = env.builder().setFirefoxOptions(options).build()

await driver.get(Pages.echoPage)
await verifyWebExtensionWasInstalled()
})
})

describe('set mobile options', function () {
Expand Down Expand Up @@ -127,14 +108,13 @@ suite(

it('can add extra prefs on top of an existing profile', async function () {
let options = env.builder().getFirefoxOptions() || new firefox.Options()
options.setPreference('general.useragent.override', 'foo;bar')
options.setProfile(profileWithWebExtension)
options.setPreference('general.useragent.override', 'baz;qux')
options.setProfile(profileWithUserPrefs)

driver = env.builder().setFirefoxOptions(options).build()

await driver.get(Pages.echoPage)
await verifyWebExtensionWasInstalled()
await verifyUserAgentWasChanged()
await verifyUserAgent('baz;qux')
})
})

Expand Down Expand Up @@ -185,8 +165,12 @@ suite(
})

async function verifyUserAgentWasChanged() {
await verifyUserAgent('foo;bar')
}

async function verifyUserAgent(expected) {
let userAgent = await driver.executeScript('return window.navigator.userAgent')
assert.strictEqual(userAgent, 'foo;bar')
assert.strictEqual(userAgent, expected)
}

async function verifyWebExtensionWasInstalled() {
Expand Down
Loading