playwright-core
Advanced tools
Comparing version 0.11.1-next.1584487135181 to 0.11.1-next.1584550591910
@@ -23,3 +23,3 @@ /** | ||
export declare type BrowserContextOptions = { | ||
viewport?: types.Viewport | null; | ||
viewport?: types.Size | null; | ||
ignoreHTTPSErrors?: boolean; | ||
@@ -36,2 +36,5 @@ javaScriptEnabled?: boolean; | ||
httpCredentials?: types.Credentials; | ||
deviceScaleFactor?: number; | ||
isMobile?: boolean; | ||
hasTouch?: boolean; | ||
}; | ||
@@ -38,0 +41,0 @@ export interface BrowserContext { |
@@ -50,3 +50,2 @@ /** | ||
}): Promise<void>; | ||
_targetInfoChanged(event: Protocol.Target.targetInfoChangedPayload): void; | ||
_closePage(page: Page): Promise<void>; | ||
@@ -53,0 +52,0 @@ close(): Promise<void>; |
@@ -50,3 +50,2 @@ "use strict"; | ||
this._session.on('Target.targetDestroyed', this._targetDestroyed.bind(this)); | ||
this._session.on('Target.targetInfoChanged', this._targetInfoChanged.bind(this)); | ||
this._session.on('Target.attachedToTarget', this._onAttachedToTarget.bind(this)); | ||
@@ -147,8 +146,2 @@ this._firstPagePromise = new Promise(f => this._firstPageCallback = f); | ||
} | ||
_targetInfoChanged(event) { | ||
const target = this._targets.get(event.targetInfo.targetId); | ||
if (!target) | ||
return; | ||
target._targetInfoChanged(event.targetInfo); | ||
} | ||
async _closePage(page) { | ||
@@ -230,3 +223,3 @@ await this._session.send('Target.closeTarget', { targetId: crTarget_1.CRTarget.fromPage(page)._targetId }); | ||
pages() { | ||
return this._targets().filter(target => target.type() === 'page').map(target => target._initializedPage()).filter(pageOrNull => !!pageOrNull); | ||
return this._targets().filter(target => target.type() === 'page').map(target => target._initializedPage).filter(pageOrNull => !!pageOrNull); | ||
} | ||
@@ -350,3 +343,3 @@ async newPage() { | ||
backgroundPages() { | ||
return this._targets().filter(target => target.type() === 'background_page').map(target => target._initializedPage()).filter(pageOrNull => !!pageOrNull); | ||
return this._targets().filter(target => target.type() === 'background_page').map(target => target._initializedPage).filter(pageOrNull => !!pageOrNull); | ||
} | ||
@@ -353,0 +346,0 @@ async newCDPSession(page) { |
@@ -30,13 +30,12 @@ /** | ||
export declare class CRPage implements PageDelegate { | ||
_client: CRSession; | ||
_initialized: boolean; | ||
readonly _client: CRSession; | ||
private readonly _page; | ||
readonly _networkManager: CRNetworkManager; | ||
private _contextIdToContext; | ||
private readonly _contextIdToContext; | ||
private _eventListeners; | ||
rawMouse: RawMouseImpl; | ||
rawKeyboard: RawKeyboardImpl; | ||
private _browser; | ||
private _pdf; | ||
private _coverage; | ||
readonly rawMouse: RawMouseImpl; | ||
readonly rawKeyboard: RawKeyboardImpl; | ||
private readonly _browser; | ||
private readonly _pdf; | ||
private readonly _coverage; | ||
private readonly _browserContext; | ||
@@ -43,0 +42,0 @@ constructor(client: CRSession, browser: CRBrowser, browserContext: CRBrowserContext); |
@@ -39,3 +39,2 @@ "use strict"; | ||
constructor(client, browser, browserContext) { | ||
this._initialized = false; | ||
this._contextIdToContext = new Map(); | ||
@@ -130,3 +129,2 @@ this._eventListeners = []; | ||
await Promise.all(promises); | ||
this._initialized = true; | ||
} | ||
@@ -304,3 +302,4 @@ didClose() { | ||
async _updateViewport(updateTouch) { | ||
let viewport = this._browserContext._options.viewport || { width: 0, height: 0 }; | ||
const options = this._browserContext._options; | ||
let viewport = options.viewport || { width: 0, height: 0 }; | ||
const viewportSize = this._page._state.viewportSize; | ||
@@ -312,3 +311,3 @@ if (viewportSize) | ||
this._client.send('Emulation.setDeviceMetricsOverride', { | ||
mobile: !!viewport.isMobile, | ||
mobile: !!options.isMobile, | ||
width: viewport.width, | ||
@@ -318,3 +317,3 @@ height: viewport.height, | ||
screenHeight: viewport.height, | ||
deviceScaleFactor: viewport.deviceScaleFactor || 1, | ||
deviceScaleFactor: options.deviceScaleFactor || 1, | ||
screenOrientation: isLandscape ? { angle: 90, type: 'landscapePrimary' } : { angle: 0, type: 'portraitPrimary' }, | ||
@@ -324,3 +323,3 @@ }), | ||
if (updateTouch) | ||
promises.push(this._client.send('Emulation.setTouchEmulationEnabled', { enabled: !!viewport.isMobile })); | ||
promises.push(this._client.send('Emulation.setTouchEmulationEnabled', { enabled: !!options.hasTouch })); | ||
await Promise.all(promises); | ||
@@ -327,0 +326,0 @@ } |
@@ -23,3 +23,3 @@ /** | ||
export declare class CRTarget { | ||
private _targetInfo; | ||
private readonly _targetInfo; | ||
private readonly _browser; | ||
@@ -29,5 +29,5 @@ private readonly _browserContext; | ||
readonly sessionFactory: () => Promise<CRSession>; | ||
private _pagePromiseCallback; | ||
private _pagePromise; | ||
_crPage: CRPage | null; | ||
private readonly _pagePromise; | ||
readonly _crPage: CRPage | null; | ||
_initializedPage: Page | null; | ||
private _workerPromise; | ||
@@ -38,10 +38,7 @@ static fromPage(page: Page): CRTarget; | ||
_didClose(): void; | ||
_initializedPage(): Page | null; | ||
pageOrError(): Promise<Page | Error>; | ||
serviceWorker(): Promise<Worker | null>; | ||
url(): string; | ||
type(): 'page' | 'background_page' | 'service_worker' | 'shared_worker' | 'other' | 'browser'; | ||
context(): CRBrowserContext; | ||
opener(): CRTarget | null; | ||
_targetInfoChanged(targetInfo: Protocol.Target.TargetInfo): void; | ||
} |
@@ -27,5 +27,5 @@ "use strict"; | ||
constructor(browser, targetInfo, browserContext, session, sessionFactory) { | ||
this._pagePromiseCallback = null; | ||
this._pagePromise = null; | ||
this._crPage = null; | ||
this._initializedPage = null; | ||
this._workerPromise = null; | ||
@@ -43,3 +43,3 @@ this._targetInfo = targetInfo; | ||
session.once(crConnection_1.CRSessionEvents.Disconnected, () => page._didDisconnect()); | ||
this._pagePromise = this._crPage.initialize().then(() => page).catch(e => e); | ||
this._pagePromise = this._crPage.initialize().then(() => this._initializedPage = page).catch(e => e); | ||
} | ||
@@ -57,7 +57,2 @@ } | ||
} | ||
_initializedPage() { | ||
if (this._crPage && this._crPage._initialized) | ||
return this._crPage.page(); | ||
return null; | ||
} | ||
async pageOrError() { | ||
@@ -85,5 +80,2 @@ if (CRTarget.isPageType(this.type())) | ||
} | ||
url() { | ||
return this._targetInfo.url; | ||
} | ||
type() { | ||
@@ -104,7 +96,4 @@ const type = this._targetInfo.type; | ||
} | ||
_targetInfoChanged(targetInfo) { | ||
this._targetInfo = targetInfo; | ||
} | ||
} | ||
exports.CRTarget = CRTarget; | ||
//# sourceMappingURL=crTarget.js.map |
@@ -24,6 +24,7 @@ "use strict"; | ||
'width': 600, | ||
'height': 1024, | ||
'deviceScaleFactor': 1, | ||
'isMobile': true | ||
} | ||
'height': 1024 | ||
}, | ||
'deviceScaleFactor': 1, | ||
'isMobile': true, | ||
'hasTouch': true | ||
}, | ||
@@ -34,6 +35,7 @@ 'Blackberry PlayBook landscape': { | ||
'width': 1024, | ||
'height': 600, | ||
'deviceScaleFactor': 1, | ||
'isMobile': true | ||
} | ||
'height': 600 | ||
}, | ||
'deviceScaleFactor': 1, | ||
'isMobile': true, | ||
'hasTouch': true | ||
}, | ||
@@ -44,6 +46,7 @@ 'BlackBerry Z30': { | ||
'width': 360, | ||
'height': 640, | ||
'deviceScaleFactor': 2, | ||
'isMobile': true | ||
} | ||
'height': 640 | ||
}, | ||
'deviceScaleFactor': 2, | ||
'isMobile': true, | ||
'hasTouch': true | ||
}, | ||
@@ -54,6 +57,7 @@ 'BlackBerry Z30 landscape': { | ||
'width': 640, | ||
'height': 360, | ||
'deviceScaleFactor': 2, | ||
'isMobile': true | ||
} | ||
'height': 360 | ||
}, | ||
'deviceScaleFactor': 2, | ||
'isMobile': true, | ||
'hasTouch': true | ||
}, | ||
@@ -64,6 +68,7 @@ 'Galaxy Note 3': { | ||
'width': 360, | ||
'height': 640, | ||
'deviceScaleFactor': 3, | ||
'isMobile': true | ||
} | ||
'height': 640 | ||
}, | ||
'deviceScaleFactor': 3, | ||
'isMobile': true, | ||
'hasTouch': true | ||
}, | ||
@@ -74,6 +79,7 @@ 'Galaxy Note 3 landscape': { | ||
'width': 640, | ||
'height': 360, | ||
'deviceScaleFactor': 3, | ||
'isMobile': true | ||
} | ||
'height': 360 | ||
}, | ||
'deviceScaleFactor': 3, | ||
'isMobile': true, | ||
'hasTouch': true | ||
}, | ||
@@ -84,6 +90,7 @@ 'Galaxy Note II': { | ||
'width': 360, | ||
'height': 640, | ||
'deviceScaleFactor': 2, | ||
'isMobile': true | ||
} | ||
'height': 640 | ||
}, | ||
'deviceScaleFactor': 2, | ||
'isMobile': true, | ||
'hasTouch': true | ||
}, | ||
@@ -94,6 +101,7 @@ 'Galaxy Note II landscape': { | ||
'width': 640, | ||
'height': 360, | ||
'deviceScaleFactor': 2, | ||
'isMobile': true | ||
} | ||
'height': 360 | ||
}, | ||
'deviceScaleFactor': 2, | ||
'isMobile': true, | ||
'hasTouch': true | ||
}, | ||
@@ -104,6 +112,7 @@ 'Galaxy S III': { | ||
'width': 360, | ||
'height': 640, | ||
'deviceScaleFactor': 2, | ||
'isMobile': true | ||
} | ||
'height': 640 | ||
}, | ||
'deviceScaleFactor': 2, | ||
'isMobile': true, | ||
'hasTouch': true | ||
}, | ||
@@ -114,6 +123,7 @@ 'Galaxy S III landscape': { | ||
'width': 640, | ||
'height': 360, | ||
'deviceScaleFactor': 2, | ||
'isMobile': true | ||
} | ||
'height': 360 | ||
}, | ||
'deviceScaleFactor': 2, | ||
'isMobile': true, | ||
'hasTouch': true | ||
}, | ||
@@ -124,6 +134,7 @@ 'Galaxy S5': { | ||
'width': 360, | ||
'height': 640, | ||
'deviceScaleFactor': 3, | ||
'isMobile': true | ||
} | ||
'height': 640 | ||
}, | ||
'deviceScaleFactor': 3, | ||
'isMobile': true, | ||
'hasTouch': true | ||
}, | ||
@@ -134,6 +145,7 @@ 'Galaxy S5 landscape': { | ||
'width': 640, | ||
'height': 360, | ||
'deviceScaleFactor': 3, | ||
'isMobile': true | ||
} | ||
'height': 360 | ||
}, | ||
'deviceScaleFactor': 3, | ||
'isMobile': true, | ||
'hasTouch': true | ||
}, | ||
@@ -144,6 +156,7 @@ 'iPad (gen 6)': { | ||
'width': 768, | ||
'height': 1024, | ||
'deviceScaleFactor': 2, | ||
'isMobile': true | ||
} | ||
'height': 1024 | ||
}, | ||
'deviceScaleFactor': 2, | ||
'isMobile': true, | ||
'hasTouch': true | ||
}, | ||
@@ -154,6 +167,7 @@ 'iPad (gen 6) landscape': { | ||
'width': 1024, | ||
'height': 768, | ||
'deviceScaleFactor': 2, | ||
'isMobile': true | ||
} | ||
'height': 768 | ||
}, | ||
'deviceScaleFactor': 2, | ||
'isMobile': true, | ||
'hasTouch': true | ||
}, | ||
@@ -164,6 +178,7 @@ 'iPad (gen 7)': { | ||
'width': 810, | ||
'height': 1080, | ||
'deviceScaleFactor': 2, | ||
'isMobile': true | ||
} | ||
'height': 1080 | ||
}, | ||
'deviceScaleFactor': 2, | ||
'isMobile': true, | ||
'hasTouch': true | ||
}, | ||
@@ -174,6 +189,7 @@ 'iPad (gen 7) landscape': { | ||
'width': 1080, | ||
'height': 810, | ||
'deviceScaleFactor': 2, | ||
'isMobile': true | ||
} | ||
'height': 810 | ||
}, | ||
'deviceScaleFactor': 2, | ||
'isMobile': true, | ||
'hasTouch': true | ||
}, | ||
@@ -184,6 +200,7 @@ 'iPad Mini': { | ||
'width': 768, | ||
'height': 1024, | ||
'deviceScaleFactor': 2, | ||
'isMobile': true | ||
} | ||
'height': 1024 | ||
}, | ||
'deviceScaleFactor': 2, | ||
'isMobile': true, | ||
'hasTouch': true | ||
}, | ||
@@ -194,6 +211,7 @@ 'iPad Mini landscape': { | ||
'width': 1024, | ||
'height': 768, | ||
'deviceScaleFactor': 2, | ||
'isMobile': true | ||
} | ||
'height': 768 | ||
}, | ||
'deviceScaleFactor': 2, | ||
'isMobile': true, | ||
'hasTouch': true | ||
}, | ||
@@ -204,6 +222,7 @@ 'iPad Pro 11': { | ||
'width': 834, | ||
'height': 1194, | ||
'deviceScaleFactor': 2, | ||
'isMobile': true | ||
} | ||
'height': 1194 | ||
}, | ||
'deviceScaleFactor': 2, | ||
'isMobile': true, | ||
'hasTouch': true | ||
}, | ||
@@ -214,6 +233,7 @@ 'iPad Pro 11 landscape': { | ||
'width': 1194, | ||
'height': 834, | ||
'deviceScaleFactor': 2, | ||
'isMobile': true | ||
} | ||
'height': 834 | ||
}, | ||
'deviceScaleFactor': 2, | ||
'isMobile': true, | ||
'hasTouch': true | ||
}, | ||
@@ -224,6 +244,7 @@ 'iPhone 6': { | ||
'width': 375, | ||
'height': 667, | ||
'deviceScaleFactor': 2, | ||
'isMobile': true | ||
} | ||
'height': 667 | ||
}, | ||
'deviceScaleFactor': 2, | ||
'isMobile': true, | ||
'hasTouch': true | ||
}, | ||
@@ -234,6 +255,7 @@ 'iPhone 6 landscape': { | ||
'width': 667, | ||
'height': 375, | ||
'deviceScaleFactor': 2, | ||
'isMobile': true | ||
} | ||
'height': 375 | ||
}, | ||
'deviceScaleFactor': 2, | ||
'isMobile': true, | ||
'hasTouch': true | ||
}, | ||
@@ -244,6 +266,7 @@ 'iPhone 6 Plus': { | ||
'width': 414, | ||
'height': 736, | ||
'deviceScaleFactor': 3, | ||
'isMobile': true | ||
} | ||
'height': 736 | ||
}, | ||
'deviceScaleFactor': 3, | ||
'isMobile': true, | ||
'hasTouch': true | ||
}, | ||
@@ -254,6 +277,7 @@ 'iPhone 6 Plus landscape': { | ||
'width': 736, | ||
'height': 414, | ||
'deviceScaleFactor': 3, | ||
'isMobile': true | ||
} | ||
'height': 414 | ||
}, | ||
'deviceScaleFactor': 3, | ||
'isMobile': true, | ||
'hasTouch': true | ||
}, | ||
@@ -264,6 +288,7 @@ 'iPhone 7': { | ||
'width': 375, | ||
'height': 667, | ||
'deviceScaleFactor': 2, | ||
'isMobile': true | ||
} | ||
'height': 667 | ||
}, | ||
'deviceScaleFactor': 2, | ||
'isMobile': true, | ||
'hasTouch': true | ||
}, | ||
@@ -274,6 +299,7 @@ 'iPhone 7 landscape': { | ||
'width': 667, | ||
'height': 375, | ||
'deviceScaleFactor': 2, | ||
'isMobile': true | ||
} | ||
'height': 375 | ||
}, | ||
'deviceScaleFactor': 2, | ||
'isMobile': true, | ||
'hasTouch': true | ||
}, | ||
@@ -284,6 +310,7 @@ 'iPhone 7 Plus': { | ||
'width': 414, | ||
'height': 736, | ||
'deviceScaleFactor': 3, | ||
'isMobile': true | ||
} | ||
'height': 736 | ||
}, | ||
'deviceScaleFactor': 3, | ||
'isMobile': true, | ||
'hasTouch': true | ||
}, | ||
@@ -294,6 +321,7 @@ 'iPhone 7 Plus landscape': { | ||
'width': 736, | ||
'height': 414, | ||
'deviceScaleFactor': 3, | ||
'isMobile': true | ||
} | ||
'height': 414 | ||
}, | ||
'deviceScaleFactor': 3, | ||
'isMobile': true, | ||
'hasTouch': true | ||
}, | ||
@@ -304,6 +332,7 @@ 'iPhone 8': { | ||
'width': 375, | ||
'height': 667, | ||
'deviceScaleFactor': 2, | ||
'isMobile': true | ||
} | ||
'height': 667 | ||
}, | ||
'deviceScaleFactor': 2, | ||
'isMobile': true, | ||
'hasTouch': true | ||
}, | ||
@@ -314,6 +343,7 @@ 'iPhone 8 landscape': { | ||
'width': 667, | ||
'height': 375, | ||
'deviceScaleFactor': 2, | ||
'isMobile': true | ||
} | ||
'height': 375 | ||
}, | ||
'deviceScaleFactor': 2, | ||
'isMobile': true, | ||
'hasTouch': true | ||
}, | ||
@@ -324,6 +354,7 @@ 'iPhone 8 Plus': { | ||
'width': 414, | ||
'height': 736, | ||
'deviceScaleFactor': 3, | ||
'isMobile': true | ||
} | ||
'height': 736 | ||
}, | ||
'deviceScaleFactor': 3, | ||
'isMobile': true, | ||
'hasTouch': true | ||
}, | ||
@@ -334,6 +365,7 @@ 'iPhone 8 Plus landscape': { | ||
'width': 736, | ||
'height': 414, | ||
'deviceScaleFactor': 3, | ||
'isMobile': true | ||
} | ||
'height': 414 | ||
}, | ||
'deviceScaleFactor': 3, | ||
'isMobile': true, | ||
'hasTouch': true | ||
}, | ||
@@ -344,6 +376,7 @@ 'iPhone SE': { | ||
'width': 320, | ||
'height': 568, | ||
'deviceScaleFactor': 2, | ||
'isMobile': true | ||
} | ||
'height': 568 | ||
}, | ||
'deviceScaleFactor': 2, | ||
'isMobile': true, | ||
'hasTouch': true | ||
}, | ||
@@ -354,6 +387,7 @@ 'iPhone SE landscape': { | ||
'width': 568, | ||
'height': 320, | ||
'deviceScaleFactor': 2, | ||
'isMobile': true | ||
} | ||
'height': 320 | ||
}, | ||
'deviceScaleFactor': 2, | ||
'isMobile': true, | ||
'hasTouch': true | ||
}, | ||
@@ -364,6 +398,7 @@ 'iPhone X': { | ||
'width': 375, | ||
'height': 812, | ||
'deviceScaleFactor': 3, | ||
'isMobile': true | ||
} | ||
'height': 812 | ||
}, | ||
'deviceScaleFactor': 3, | ||
'isMobile': true, | ||
'hasTouch': true | ||
}, | ||
@@ -374,6 +409,7 @@ 'iPhone X landscape': { | ||
'width': 812, | ||
'height': 375, | ||
'deviceScaleFactor': 3, | ||
'isMobile': true | ||
} | ||
'height': 375 | ||
}, | ||
'deviceScaleFactor': 3, | ||
'isMobile': true, | ||
'hasTouch': true | ||
}, | ||
@@ -384,6 +420,7 @@ 'iPhone XR': { | ||
'width': 414, | ||
'height': 896, | ||
'deviceScaleFactor': 3, | ||
'isMobile': true | ||
} | ||
'height': 896 | ||
}, | ||
'deviceScaleFactor': 3, | ||
'isMobile': true, | ||
'hasTouch': true | ||
}, | ||
@@ -394,6 +431,7 @@ 'iPhone XR landscape': { | ||
'width': 896, | ||
'height': 414, | ||
'deviceScaleFactor': 3, | ||
'isMobile': true | ||
} | ||
'height': 414 | ||
}, | ||
'deviceScaleFactor': 3, | ||
'isMobile': true, | ||
'hasTouch': true | ||
}, | ||
@@ -404,6 +442,7 @@ 'iPhone 11': { | ||
'width': 414, | ||
'height': 896, | ||
'deviceScaleFactor': 2, | ||
'isMobile': true | ||
} | ||
'height': 896 | ||
}, | ||
'deviceScaleFactor': 2, | ||
'isMobile': true, | ||
'hasTouch': true | ||
}, | ||
@@ -414,6 +453,7 @@ 'iPhone 11 landscape': { | ||
'width': 896, | ||
'height': 414, | ||
'deviceScaleFactor': 2, | ||
'isMobile': true | ||
} | ||
'height': 414 | ||
}, | ||
'deviceScaleFactor': 2, | ||
'isMobile': true, | ||
'hasTouch': true | ||
}, | ||
@@ -424,6 +464,7 @@ 'iPhone 11 Pro': { | ||
'width': 375, | ||
'height': 812, | ||
'deviceScaleFactor': 3, | ||
'isMobile': true | ||
} | ||
'height': 812 | ||
}, | ||
'deviceScaleFactor': 3, | ||
'isMobile': true, | ||
'hasTouch': true | ||
}, | ||
@@ -434,6 +475,7 @@ 'iPhone 11 Pro landscape': { | ||
'width': 812, | ||
'height': 375, | ||
'deviceScaleFactor': 3, | ||
'isMobile': true | ||
} | ||
'height': 375 | ||
}, | ||
'deviceScaleFactor': 3, | ||
'isMobile': true, | ||
'hasTouch': true | ||
}, | ||
@@ -444,6 +486,7 @@ 'iPhone 11 Pro Max': { | ||
'width': 414, | ||
'height': 896, | ||
'deviceScaleFactor': 3, | ||
'isMobile': true | ||
} | ||
'height': 896 | ||
}, | ||
'deviceScaleFactor': 3, | ||
'isMobile': true, | ||
'hasTouch': true | ||
}, | ||
@@ -454,6 +497,7 @@ 'iPhone 11 Pro Max landscape': { | ||
'width': 896, | ||
'height': 414, | ||
'deviceScaleFactor': 3, | ||
'isMobile': true | ||
} | ||
'height': 414 | ||
}, | ||
'deviceScaleFactor': 3, | ||
'isMobile': true, | ||
'hasTouch': true | ||
}, | ||
@@ -464,6 +508,7 @@ 'JioPhone 2': { | ||
'width': 240, | ||
'height': 320, | ||
'deviceScaleFactor': 1, | ||
'isMobile': true | ||
} | ||
'height': 320 | ||
}, | ||
'deviceScaleFactor': 1, | ||
'isMobile': true, | ||
'hasTouch': true | ||
}, | ||
@@ -474,6 +519,7 @@ 'JioPhone 2 landscape': { | ||
'width': 320, | ||
'height': 240, | ||
'deviceScaleFactor': 1, | ||
'isMobile': true | ||
} | ||
'height': 240 | ||
}, | ||
'deviceScaleFactor': 1, | ||
'isMobile': true, | ||
'hasTouch': true | ||
}, | ||
@@ -484,6 +530,7 @@ 'Kindle Fire HDX': { | ||
'width': 800, | ||
'height': 1280, | ||
'deviceScaleFactor': 2, | ||
'isMobile': true | ||
} | ||
'height': 1280 | ||
}, | ||
'deviceScaleFactor': 2, | ||
'isMobile': true, | ||
'hasTouch': true | ||
}, | ||
@@ -494,6 +541,7 @@ 'Kindle Fire HDX landscape': { | ||
'width': 1280, | ||
'height': 800, | ||
'deviceScaleFactor': 2, | ||
'isMobile': true | ||
} | ||
'height': 800 | ||
}, | ||
'deviceScaleFactor': 2, | ||
'isMobile': true, | ||
'hasTouch': true | ||
}, | ||
@@ -504,6 +552,7 @@ 'LG Optimus L70': { | ||
'width': 384, | ||
'height': 640, | ||
'deviceScaleFactor': 1.25, | ||
'isMobile': true | ||
} | ||
'height': 640 | ||
}, | ||
'deviceScaleFactor': 1.25, | ||
'isMobile': true, | ||
'hasTouch': true | ||
}, | ||
@@ -514,6 +563,7 @@ 'LG Optimus L70 landscape': { | ||
'width': 640, | ||
'height': 384, | ||
'deviceScaleFactor': 1.25, | ||
'isMobile': true | ||
} | ||
'height': 384 | ||
}, | ||
'deviceScaleFactor': 1.25, | ||
'isMobile': true, | ||
'hasTouch': true | ||
}, | ||
@@ -524,6 +574,7 @@ 'Microsoft Lumia 550': { | ||
'width': 640, | ||
'height': 360, | ||
'deviceScaleFactor': 2, | ||
'isMobile': true | ||
} | ||
'height': 360 | ||
}, | ||
'deviceScaleFactor': 2, | ||
'isMobile': true, | ||
'hasTouch': true | ||
}, | ||
@@ -534,6 +585,7 @@ 'Microsoft Lumia 550 landscape': { | ||
'width': 360, | ||
'height': 640, | ||
'deviceScaleFactor': 2, | ||
'isMobile': true | ||
} | ||
'height': 640 | ||
}, | ||
'deviceScaleFactor': 2, | ||
'isMobile': true, | ||
'hasTouch': true | ||
}, | ||
@@ -544,6 +596,7 @@ 'Microsoft Lumia 950': { | ||
'width': 360, | ||
'height': 640, | ||
'deviceScaleFactor': 4, | ||
'isMobile': true | ||
} | ||
'height': 640 | ||
}, | ||
'deviceScaleFactor': 4, | ||
'isMobile': true, | ||
'hasTouch': true | ||
}, | ||
@@ -554,6 +607,7 @@ 'Microsoft Lumia 950 landscape': { | ||
'width': 640, | ||
'height': 360, | ||
'deviceScaleFactor': 4, | ||
'isMobile': true | ||
} | ||
'height': 360 | ||
}, | ||
'deviceScaleFactor': 4, | ||
'isMobile': true, | ||
'hasTouch': true | ||
}, | ||
@@ -564,6 +618,7 @@ 'Nexus 10': { | ||
'width': 800, | ||
'height': 1280, | ||
'deviceScaleFactor': 2, | ||
'isMobile': true | ||
} | ||
'height': 1280 | ||
}, | ||
'deviceScaleFactor': 2, | ||
'isMobile': true, | ||
'hasTouch': true | ||
}, | ||
@@ -574,6 +629,7 @@ 'Nexus 10 landscape': { | ||
'width': 1280, | ||
'height': 800, | ||
'deviceScaleFactor': 2, | ||
'isMobile': true | ||
} | ||
'height': 800 | ||
}, | ||
'deviceScaleFactor': 2, | ||
'isMobile': true, | ||
'hasTouch': true | ||
}, | ||
@@ -584,6 +640,7 @@ 'Nexus 4': { | ||
'width': 384, | ||
'height': 640, | ||
'deviceScaleFactor': 2, | ||
'isMobile': true | ||
} | ||
'height': 640 | ||
}, | ||
'deviceScaleFactor': 2, | ||
'isMobile': true, | ||
'hasTouch': true | ||
}, | ||
@@ -594,6 +651,7 @@ 'Nexus 4 landscape': { | ||
'width': 640, | ||
'height': 384, | ||
'deviceScaleFactor': 2, | ||
'isMobile': true | ||
} | ||
'height': 384 | ||
}, | ||
'deviceScaleFactor': 2, | ||
'isMobile': true, | ||
'hasTouch': true | ||
}, | ||
@@ -604,6 +662,7 @@ 'Nexus 5': { | ||
'width': 360, | ||
'height': 640, | ||
'deviceScaleFactor': 3, | ||
'isMobile': true | ||
} | ||
'height': 640 | ||
}, | ||
'deviceScaleFactor': 3, | ||
'isMobile': true, | ||
'hasTouch': true | ||
}, | ||
@@ -614,6 +673,7 @@ 'Nexus 5 landscape': { | ||
'width': 640, | ||
'height': 360, | ||
'deviceScaleFactor': 3, | ||
'isMobile': true | ||
} | ||
'height': 360 | ||
}, | ||
'deviceScaleFactor': 3, | ||
'isMobile': true, | ||
'hasTouch': true | ||
}, | ||
@@ -624,6 +684,7 @@ 'Nexus 5X': { | ||
'width': 412, | ||
'height': 732, | ||
'deviceScaleFactor': 2.625, | ||
'isMobile': true | ||
} | ||
'height': 732 | ||
}, | ||
'deviceScaleFactor': 2.625, | ||
'isMobile': true, | ||
'hasTouch': true | ||
}, | ||
@@ -634,6 +695,7 @@ 'Nexus 5X landscape': { | ||
'width': 732, | ||
'height': 412, | ||
'deviceScaleFactor': 2.625, | ||
'isMobile': true | ||
} | ||
'height': 412 | ||
}, | ||
'deviceScaleFactor': 2.625, | ||
'isMobile': true, | ||
'hasTouch': true | ||
}, | ||
@@ -644,6 +706,7 @@ 'Nexus 6': { | ||
'width': 412, | ||
'height': 732, | ||
'deviceScaleFactor': 3.5, | ||
'isMobile': true | ||
} | ||
'height': 732 | ||
}, | ||
'deviceScaleFactor': 3.5, | ||
'isMobile': true, | ||
'hasTouch': true | ||
}, | ||
@@ -654,6 +717,7 @@ 'Nexus 6 landscape': { | ||
'width': 732, | ||
'height': 412, | ||
'deviceScaleFactor': 3.5, | ||
'isMobile': true | ||
} | ||
'height': 412 | ||
}, | ||
'deviceScaleFactor': 3.5, | ||
'isMobile': true, | ||
'hasTouch': true | ||
}, | ||
@@ -664,6 +728,7 @@ 'Nexus 6P': { | ||
'width': 412, | ||
'height': 732, | ||
'deviceScaleFactor': 3.5, | ||
'isMobile': true | ||
} | ||
'height': 732 | ||
}, | ||
'deviceScaleFactor': 3.5, | ||
'isMobile': true, | ||
'hasTouch': true | ||
}, | ||
@@ -674,6 +739,7 @@ 'Nexus 6P landscape': { | ||
'width': 732, | ||
'height': 412, | ||
'deviceScaleFactor': 3.5, | ||
'isMobile': true | ||
} | ||
'height': 412 | ||
}, | ||
'deviceScaleFactor': 3.5, | ||
'isMobile': true, | ||
'hasTouch': true | ||
}, | ||
@@ -684,6 +750,7 @@ 'Nexus 7': { | ||
'width': 600, | ||
'height': 960, | ||
'deviceScaleFactor': 2, | ||
'isMobile': true | ||
} | ||
'height': 960 | ||
}, | ||
'deviceScaleFactor': 2, | ||
'isMobile': true, | ||
'hasTouch': true | ||
}, | ||
@@ -694,6 +761,7 @@ 'Nexus 7 landscape': { | ||
'width': 960, | ||
'height': 600, | ||
'deviceScaleFactor': 2, | ||
'isMobile': true | ||
} | ||
'height': 600 | ||
}, | ||
'deviceScaleFactor': 2, | ||
'isMobile': true, | ||
'hasTouch': true | ||
}, | ||
@@ -704,6 +772,7 @@ 'Nokia Lumia 520': { | ||
'width': 320, | ||
'height': 533, | ||
'deviceScaleFactor': 1.5, | ||
'isMobile': true | ||
} | ||
'height': 533 | ||
}, | ||
'deviceScaleFactor': 1.5, | ||
'isMobile': true, | ||
'hasTouch': true | ||
}, | ||
@@ -714,6 +783,7 @@ 'Nokia Lumia 520 landscape': { | ||
'width': 533, | ||
'height': 320, | ||
'deviceScaleFactor': 1.5, | ||
'isMobile': true | ||
} | ||
'height': 320 | ||
}, | ||
'deviceScaleFactor': 1.5, | ||
'isMobile': true, | ||
'hasTouch': true | ||
}, | ||
@@ -724,6 +794,7 @@ 'Nokia N9': { | ||
'width': 480, | ||
'height': 854, | ||
'deviceScaleFactor': 1, | ||
'isMobile': true | ||
} | ||
'height': 854 | ||
}, | ||
'deviceScaleFactor': 1, | ||
'isMobile': true, | ||
'hasTouch': true | ||
}, | ||
@@ -734,6 +805,7 @@ 'Nokia N9 landscape': { | ||
'width': 854, | ||
'height': 480, | ||
'deviceScaleFactor': 1, | ||
'isMobile': true | ||
} | ||
'height': 480 | ||
}, | ||
'deviceScaleFactor': 1, | ||
'isMobile': true, | ||
'hasTouch': true | ||
}, | ||
@@ -744,6 +816,7 @@ 'Pixel 2': { | ||
'width': 411, | ||
'height': 731, | ||
'deviceScaleFactor': 2.625, | ||
'isMobile': true | ||
} | ||
'height': 731 | ||
}, | ||
'deviceScaleFactor': 2.625, | ||
'isMobile': true, | ||
'hasTouch': true | ||
}, | ||
@@ -754,6 +827,7 @@ 'Pixel 2 landscape': { | ||
'width': 731, | ||
'height': 411, | ||
'deviceScaleFactor': 2.625, | ||
'isMobile': true | ||
} | ||
'height': 411 | ||
}, | ||
'deviceScaleFactor': 2.625, | ||
'isMobile': true, | ||
'hasTouch': true | ||
}, | ||
@@ -764,6 +838,7 @@ 'Pixel 2 XL': { | ||
'width': 411, | ||
'height': 823, | ||
'deviceScaleFactor': 3.5, | ||
'isMobile': true | ||
} | ||
'height': 823 | ||
}, | ||
'deviceScaleFactor': 3.5, | ||
'isMobile': true, | ||
'hasTouch': true | ||
}, | ||
@@ -774,8 +849,9 @@ 'Pixel 2 XL landscape': { | ||
'width': 823, | ||
'height': 411, | ||
'deviceScaleFactor': 3.5, | ||
'isMobile': true | ||
} | ||
'height': 411 | ||
}, | ||
'deviceScaleFactor': 3.5, | ||
'isMobile': true, | ||
'hasTouch': true | ||
} | ||
}; | ||
//# sourceMappingURL=deviceDescriptors.js.map |
@@ -63,7 +63,9 @@ "use strict"; | ||
// TODO: remove isMobile/hasTouch from the protocol? | ||
if (options.viewport.isMobile) | ||
throw new Error('viewport.isMobile is not supported in Firefox'); | ||
if (options.isMobile) | ||
throw new Error('options.isMobile is not supported in Firefox'); | ||
if (options.hasTouch) | ||
throw new Error('options.hasTouch is not supported in Firefox'); | ||
viewport = { | ||
viewportSize: { width: options.viewport.width, height: options.viewport.height }, | ||
deviceScaleFactor: options.viewport.deviceScaleFactor || 1, | ||
deviceScaleFactor: options.deviceScaleFactor || 1, | ||
isMobile: false, | ||
@@ -70,0 +72,0 @@ hasTouch: false, |
@@ -78,8 +78,2 @@ /** | ||
}; | ||
export declare type Viewport = { | ||
width: number; | ||
height: number; | ||
deviceScaleFactor?: number; | ||
isMobile?: boolean; | ||
}; | ||
export declare type URLMatch = string | RegExp | ((url: URL) => boolean); | ||
@@ -111,3 +105,6 @@ export declare type Credentials = { | ||
userAgent: string; | ||
viewport: Viewport; | ||
viewport: Size; | ||
deviceScaleFactor: number; | ||
isMobile: boolean; | ||
hasTouch: boolean; | ||
}; | ||
@@ -114,0 +111,0 @@ export declare type Devices = { |
@@ -132,3 +132,3 @@ "use strict"; | ||
promises.push(session.send('Network.setEmulateOfflineState', { offline: true })); | ||
promises.push(session.send('Page.setTouchEmulationEnabled', { enabled: contextOptions.viewport ? !!contextOptions.viewport.isMobile : false })); | ||
promises.push(session.send('Page.setTouchEmulationEnabled', { enabled: !!contextOptions.hasTouch })); | ||
if (contextOptions.timezoneId) { | ||
@@ -428,3 +428,4 @@ promises.push(session.send('Page.setTimeZone', { timeZone: contextOptions.timezoneId }). | ||
async _updateViewport() { | ||
let viewport = this._browserContext._options.viewport || { width: 0, height: 0 }; | ||
const options = this._browserContext._options; | ||
let viewport = options.viewport || { width: 0, height: 0 }; | ||
const viewportSize = this._page._state.viewportSize; | ||
@@ -437,4 +438,4 @@ if (viewportSize) | ||
height: viewport.height, | ||
fixedLayout: !!viewport.isMobile, | ||
deviceScaleFactor: viewport.deviceScaleFactor || 1 | ||
fixedLayout: !!options.isMobile, | ||
deviceScaleFactor: options.deviceScaleFactor || 1 | ||
}), | ||
@@ -441,0 +442,0 @@ this._session.send('Page.setScreenSizeOverride', { |
{ | ||
"name": "playwright-core", | ||
"version": "0.11.1-next.1584487135181", | ||
"version": "0.11.1-next.1584550591910", | ||
"description": "A high-level API to automate web browsers", | ||
@@ -5,0 +5,0 @@ "repository": "github:Microsoft/playwright", |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2440881
57179