MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / #init

Method #init

javascript/selenium-webdriver/lib/network.js:38–57  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

36 // Since it involves awaiting to get the instance and then another await to call the method.
37 // Using this allows the user to do this "await driver.network.addAuthenticationHandler(callback)"
38 async #init() {
39 if (this.#network !== undefined) {
40 return
41 }
42 this.#network = await getNetwork(this.#driver)
43
44 await this.#network.addIntercept(new AddInterceptParameters(InterceptPhase.AUTH_REQUIRED))
45
46 await this.#network.authRequired(async (event) => {
47 const requestId = event.request.request
48 const uri = event.request.url
49 const credentials = this.getAuthCredentials(uri)
50 if (credentials !== null) {
51 await this.#network.continueWithAuth(requestId, credentials.username, credentials.password)
52 return
53 }
54
55 await this.#network.continueWithAuthNoCredentials(requestId)
56 })
57 }
58
59 getAuthCredentials(uri) {
60 for (let [, value] of this.#authHandlers) {

Callers 2

Calls 5

getAuthCredentialsMethod · 0.95
addInterceptMethod · 0.45
authRequiredMethod · 0.45
continueWithAuthMethod · 0.45

Tested by

no test coverage detected