feat: set view port for ENTIRE context
This commit is contained in:
@@ -90,7 +90,12 @@ export class RemoteBrowser {
|
||||
*/
|
||||
public initialize = async (options: RemoteBrowserOptions): Promise<void> => {
|
||||
this.browser = <Browser>(await options.browser.launch(options.launchOptions));
|
||||
const context = await this.browser.newContext();
|
||||
const context = await this.browser.newContext(
|
||||
{
|
||||
viewport: { height: 500, width: 900 },
|
||||
// recordVideo: { dir: 'videos/' }
|
||||
}
|
||||
);
|
||||
this.currentPage = await context.newPage();
|
||||
const blocker = await PlaywrightBlocker.fromPrebuiltAdsAndTracking(fetch);
|
||||
await blocker.enableBlockingInPage(this.currentPage);
|
||||
@@ -275,7 +280,7 @@ export class RemoteBrowser {
|
||||
if (page) {
|
||||
await this.stopScreencast();
|
||||
this.currentPage = page;
|
||||
await this.currentPage.setViewportSize({ height: 500, width: 1280 })
|
||||
await this.currentPage.setViewportSize({ height: 500, width: 900 })
|
||||
this.client = await this.currentPage.context().newCDPSession(this.currentPage);
|
||||
this.socket.emit('urlChanged', this.currentPage.url());
|
||||
await this.makeAndEmitScreenshot();
|
||||
|
||||
Reference in New Issue
Block a user