Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] website does not extend to full size #813

Closed
bpasero opened this issue Feb 3, 2020 · 9 comments
Closed

[BUG] website does not extend to full size #813

bpasero opened this issue Feb 3, 2020 · 9 comments

Comments

@bpasero
Copy link
Member

bpasero commented Feb 3, 2020

Context:

  • PlayWright Version: [what PlayWright version do you use?] 0.10.0
  • Operating System: [e.g. Windows, Linux or Mac] macOS 10.15.2

I wonder how to get my app span the entire window?

image

I experimented with passing over viewport, but I am not sure that is correct. I simply want the viewport of whatever the browser window size is.

@pavelfeldman
Copy link
Member

👋 @bpasero

That would be set on the browser.newContext level:

const { chromium, firefox, webkit } = require('playwright');
  
(async () => {
  const browser = await chromium.launch({ headless: false });
  const context = await browser.newContext({ viewport: null });
  const page = await context.newPage('https://visualstudio.microsoft.com/services/visual-studio-online/');
})();

We'd like users to create a browser context per test and all the configurations would go there. We can't make headless a part of it since headless controls the binary being launched, since the split. Note that we might change some names before we hit 1.0 since we aren't entirely happy about the Browser/BrowserContext naming.

@bpasero
Copy link
Member Author

bpasero commented Feb 3, 2020

Hi @pavelfeldman, I would if possible try to not create a new context but use the tab that opens by default to reduce the number of things that open. My current code to run is this:

const browser = await playwright[engine].launch({
	headless
});
const page = (await browser.defaultContext().pages())[0];
await page.setViewport({ width, height });
await page.goto(`${endpoint}&folder=vscode-remote://localhost:9888${URI.file(workspacePath!).path}`);

Ideally I could have a setting to simply fill the view port.

@pavelfeldman
Copy link
Member

Got it. Just testing the waters here: would it work for you if defaultContext was not opening its first page? Rationale: default context is extremely limited in the emulations that you can apply and can't be used in the cloud scenario - we want to maintain a 'context per user story' operation.

@bpasero
Copy link
Member Author

bpasero commented Feb 4, 2020

@pavelfeldman yeah I think that would work. Summarising my requirements:

  • browser opens with a good size in the middle of the screen (like VSCode default window size and position)
  • there is just 1 tab opened
  • I can load my test URL into that 1 tab
  • the contents of the tab fill the entire size of that tab (e.g. VSCode appears fully in that size)

@pavelfeldman
Copy link
Member

I believe this is now possible!

kaihendry added a commit to kaihendry/webscreenshot that referenced this issue Apr 14, 2020
@Treshch1
Copy link

solution with context = browser.newContext(viewport=None) does not work in python playwright version. Or maybe I'm trying it in the wrong way?

@alterhu2020
Copy link

solution with context = browser.newContext(viewport=None) does not work in python playwright version. Or maybe I'm trying it in the wrong way?

Same question here, Team, Do we have any options to open the browser in full screen size? thanks

@ameyanatu
Copy link

use '--window-position=0,0' in args and capture the current viewport using pyautogui or any other python library, which will properly maximize the browser window in playwright python

sand4rt pushed a commit to sand4rt/playwright that referenced this issue Dec 21, 2022
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
@frapbod
Copy link

frapbod commented Apr 9, 2023

Leaving this here since I found this issue when searching for viewport issues with python playwright.
At least for playwright version 1.32.1 (only one I tested)
When opening the new browser context provide the argument:
no_viewport=True
Archived Source link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants