playwright-core
Advanced tools
Comparing version
@@ -36,2 +36,3 @@ /** | ||
offline?: boolean; | ||
httpCredentials?: types.Credentials; | ||
}; | ||
@@ -51,2 +52,3 @@ export interface BrowserContext { | ||
setOffline(offline: boolean): Promise<void>; | ||
setHTTPCredentials(httpCredentials: types.Credentials | null): Promise<void>; | ||
addInitScript(script: Function | string | { | ||
@@ -81,2 +83,3 @@ path?: string; | ||
abstract setGeolocation(geolocation: types.Geolocation | null): Promise<void>; | ||
abstract setHTTPCredentials(httpCredentials: types.Credentials | null): Promise<void>; | ||
abstract setExtraHTTPHeaders(headers: network.Headers): Promise<void>; | ||
@@ -83,0 +86,0 @@ abstract setOffline(offline: boolean): Promise<void>; |
@@ -77,2 +77,3 @@ /** | ||
setOffline(offline: boolean): Promise<void>; | ||
setHTTPCredentials(httpCredentials: types.Credentials | null): Promise<void>; | ||
addInitScript(script: Function | string | { | ||
@@ -79,0 +80,0 @@ path?: string; |
@@ -209,2 +209,4 @@ "use strict"; | ||
await this.setOffline(this._options.offline); | ||
if (this._options.httpCredentials) | ||
await this.setHTTPCredentials(this._options.httpCredentials); | ||
} | ||
@@ -298,2 +300,7 @@ _existingPages() { | ||
} | ||
async setHTTPCredentials(httpCredentials) { | ||
this._options.httpCredentials = httpCredentials || undefined; | ||
for (const page of this._existingPages()) | ||
await page._delegate._networkManager.authenticate(httpCredentials); | ||
} | ||
async addInitScript(script, ...args) { | ||
@@ -300,0 +307,0 @@ const source = await helper_1.helper.evaluationScript(script, args); |
@@ -75,3 +75,2 @@ /** | ||
setRequestInterception(enabled: boolean): Promise<void>; | ||
authenticate(credentials: types.Credentials | null): Promise<void>; | ||
setFileChooserIntercepted(enabled: boolean): Promise<void>; | ||
@@ -78,0 +77,0 @@ opener(): Promise<Page | null>; |
@@ -106,2 +106,4 @@ "use strict"; | ||
promises.push(this._networkManager.setOffline(options.offline)); | ||
if (options.httpCredentials) | ||
promises.push(this._networkManager.authenticate(options.httpCredentials)); | ||
for (const binding of this._browserContext._pageBindings.values()) | ||
@@ -325,5 +327,2 @@ promises.push(this._initBinding(binding)); | ||
} | ||
async authenticate(credentials) { | ||
await this._networkManager.authenticate(credentials); | ||
} | ||
async setFileChooserIntercepted(enabled) { | ||
@@ -330,0 +329,0 @@ await this._client.send('Page.setInterceptFileChooserDialog', { enabled }).catch(e => { }); // target can be closed. |
@@ -89,2 +89,3 @@ /** | ||
setOffline(offline: boolean): Promise<void>; | ||
setHTTPCredentials(httpCredentials: types.Credentials | null): Promise<void>; | ||
addInitScript(script: Function | string | { | ||
@@ -91,0 +92,0 @@ path?: string; |
@@ -245,2 +245,4 @@ "use strict"; | ||
await this.setOffline(this._options.offline); | ||
if (this._options.httpCredentials) | ||
await this.setHTTPCredentials(this._options.httpCredentials); | ||
} | ||
@@ -324,2 +326,6 @@ _existingPages() { | ||
} | ||
async setHTTPCredentials(httpCredentials) { | ||
this._options.httpCredentials = httpCredentials || undefined; | ||
await this._browser._connection.send('Browser.setHTTPCredentials', { browserContextId: this._browserContextId || undefined, credentials: httpCredentials }); | ||
} | ||
async addInitScript(script, ...args) { | ||
@@ -326,0 +332,0 @@ const source = await helper_1.helper.evaluationScript(script, args); |
@@ -66,3 +66,2 @@ /** | ||
setRequestInterception(enabled: boolean): Promise<void>; | ||
authenticate(credentials: types.Credentials | null): Promise<void>; | ||
setFileChooserIntercepted(enabled: boolean): Promise<void>; | ||
@@ -69,0 +68,0 @@ opener(): Promise<Page | null>; |
@@ -240,5 +240,2 @@ "use strict"; | ||
} | ||
async authenticate(credentials) { | ||
await this._session.send('Network.setAuthCredentials', credentials || { username: null, password: null }); | ||
} | ||
async setFileChooserIntercepted(enabled) { | ||
@@ -245,0 +242,0 @@ await this._session.send('Page.setInterceptFileChooserDialog', { enabled }).catch(e => { }); // target can be closed. |
@@ -45,2 +45,10 @@ export declare module Protocol { | ||
type setExtraHTTPHeadersReturnValue = void; | ||
type setHTTPCredentialsParameters = { | ||
browserContextId?: string; | ||
credentials: { | ||
username: string; | ||
password: string; | ||
} | null; | ||
}; | ||
type setHTTPCredentialsReturnValue = void; | ||
type addScriptToEvaluateOnNewDocumentParameters = { | ||
@@ -651,2 +659,6 @@ browserContextId?: string; | ||
}; | ||
type HTTPCredentials = { | ||
username: string; | ||
password: string; | ||
}; | ||
type SecurityDetails = { | ||
@@ -744,7 +756,2 @@ protocol: string; | ||
}; | ||
type setAuthCredentialsParameters = { | ||
username: string | null; | ||
password: string | null; | ||
}; | ||
type setAuthCredentialsReturnValue = void; | ||
} | ||
@@ -857,2 +864,3 @@ module Accessibility { | ||
"Browser.setExtraHTTPHeaders": Browser.setExtraHTTPHeadersParameters; | ||
"Browser.setHTTPCredentials": Browser.setHTTPCredentialsParameters; | ||
"Browser.addScriptToEvaluateOnNewDocument": Browser.addScriptToEvaluateOnNewDocumentParameters; | ||
@@ -906,3 +914,2 @@ "Browser.grantPermissions": Browser.grantPermissionsParameters; | ||
"Network.getResponseBody": Network.getResponseBodyParameters; | ||
"Network.setAuthCredentials": Network.setAuthCredentialsParameters; | ||
"Accessibility.getFullAXTree": Accessibility.getFullAXTreeParameters; | ||
@@ -915,2 +922,3 @@ } | ||
"Browser.setExtraHTTPHeaders": Browser.setExtraHTTPHeadersReturnValue; | ||
"Browser.setHTTPCredentials": Browser.setHTTPCredentialsReturnValue; | ||
"Browser.addScriptToEvaluateOnNewDocument": Browser.addScriptToEvaluateOnNewDocumentReturnValue; | ||
@@ -964,5 +972,4 @@ "Browser.grantPermissions": Browser.grantPermissionsReturnValue; | ||
"Network.getResponseBody": Network.getResponseBodyReturnValue; | ||
"Network.setAuthCredentials": Network.setAuthCredentialsReturnValue; | ||
"Accessibility.getFullAXTree": Accessibility.getFullAXTreeReturnValue; | ||
} | ||
} |
@@ -44,3 +44,2 @@ /** | ||
setRequestInterception(enabled: boolean): Promise<void>; | ||
authenticate(credentials: types.Credentials | null): Promise<void>; | ||
setFileChooserIntercepted(enabled: boolean): Promise<void>; | ||
@@ -82,3 +81,2 @@ canScreenshotOutsideViewport(): boolean; | ||
interceptNetwork: boolean | null; | ||
credentials: types.Credentials | null; | ||
hasTouch: boolean | null; | ||
@@ -183,3 +181,2 @@ }; | ||
_requestStarted(request: network.Request): void; | ||
authenticate(credentials: types.Credentials | null): Promise<void>; | ||
screenshot(options?: types.ScreenshotOptions): Promise<platform.BufferType>; | ||
@@ -186,0 +183,0 @@ title(): Promise<string>; |
@@ -85,3 +85,2 @@ "use strict"; | ||
interceptNetwork: null, | ||
credentials: null, | ||
hasTouch: null, | ||
@@ -293,6 +292,2 @@ }; | ||
} | ||
async authenticate(credentials) { | ||
this._state.credentials = credentials; | ||
await this._delegate.authenticate(credentials); | ||
} | ||
async screenshot(options) { | ||
@@ -299,0 +294,0 @@ return this._screenshotter.screenshotPage(options); |
@@ -69,2 +69,3 @@ /** | ||
setOffline(offline: boolean): Promise<void>; | ||
setHTTPCredentials(httpCredentials: types.Credentials | null): Promise<void>; | ||
addInitScript(script: Function | string | { | ||
@@ -71,0 +72,0 @@ path?: string; |
@@ -166,2 +166,4 @@ "use strict"; | ||
await this.setOffline(this._options.offline); | ||
if (this._options.httpCredentials) | ||
await this.setHTTPCredentials(this._options.httpCredentials); | ||
} | ||
@@ -242,2 +244,7 @@ _existingPages() { | ||
} | ||
async setHTTPCredentials(httpCredentials) { | ||
this._options.httpCredentials = httpCredentials || undefined; | ||
for (const page of this._existingPages()) | ||
await page._delegate.updateHttpCredentials(); | ||
} | ||
async addInitScript(script, ...args) { | ||
@@ -244,0 +251,0 @@ const source = await helper_1.helper.evaluationScript(script, args); |
@@ -88,3 +88,3 @@ /** | ||
updateOffline(): Promise<void>; | ||
authenticate(credentials: types.Credentials | null): Promise<void>; | ||
updateHttpCredentials(): Promise<void>; | ||
setFileChooserIntercepted(enabled: boolean): Promise<void>; | ||
@@ -91,0 +91,0 @@ opener(): Promise<Page | null>; |
@@ -71,3 +71,2 @@ "use strict"; | ||
this._pageProxySession.send('Emulation.setActiveAndFocused', { active: true }), | ||
this.authenticate(this._page._state.credentials) | ||
]; | ||
@@ -79,2 +78,3 @@ const contextOptions = this._browserContext._options; | ||
promises.push(this._updateViewport(true /* updateTouch */)); | ||
promises.push(this.updateHttpCredentials()); | ||
await Promise.all(promises); | ||
@@ -454,4 +454,5 @@ } | ||
} | ||
async authenticate(credentials) { | ||
await this._pageProxySession.send('Emulation.setAuthCredentials', { ...(credentials || { username: '', password: '' }) }); | ||
async updateHttpCredentials() { | ||
const credentials = this._browserContext._options.httpCredentials || { username: '', password: '' }; | ||
await this._pageProxySession.send('Emulation.setAuthCredentials', { username: credentials.username, password: credentials.password }); | ||
} | ||
@@ -458,0 +459,0 @@ async setFileChooserIntercepted(enabled) { |
{ | ||
"name": "playwright-core", | ||
"version": "0.11.1-next.1583531345180", | ||
"version": "0.11.1-next.1583532343996", | ||
"description": "A high-level API to automate web browsers", | ||
@@ -12,3 +12,3 @@ "repository": "github:Microsoft/playwright", | ||
"chromium_revision": "747023", | ||
"firefox_revision": "1035", | ||
"firefox_revision": "1039", | ||
"webkit_revision": "1168" | ||
@@ -15,0 +15,0 @@ }, |
Sorry, the diff of this file is too big to display
2445177
0.09%57377
0.06%