Playwright: [Feature] context.newPage() to open a new tab instead of a new window in Firefox

Created on 31 Aug 2020  Â·  11Comments  Â·  Source: microsoft/playwright

Was expecting a new tab
I am not sure if I've seen this before when using puppeteer

P3-collecting-feedback

All 11 comments

Yes, this is the expected behavior. Each page lives in its own window. This changed in v1.3 previously all pages would open as tabs in the same window.

What's the rationale behind this?

There is a few, we don't want pages from different contexts to live in the same window, also having pages in same window would make it difficult to screencast all of them in headful mode.

Is it possible to have an option to launch a page in the same window ?
I'm using playwright to test an extension with specific behavior regarding tabs/windows.

Is it possible to have an option to launch a page in the same window ?
I'm using playwright to test an extension with specific behavior regarding tabs/windows.

+1 to have an option to launch new page in the same window. There are tests I have to use launchPersistentContext which is more convenient when all pages are in the same window

Just for screencast used probably by 1% of playwright user I think its unfair to launch each page as window instead of tab. The tests are behaving so weird now :(.

Yes, I hope the devs become more responsive

Thanks for the feedback, @shirshak55 and @sublimator. We looked at how users were running their tests in headful mode (since this only impacts headful), and noticed that they tend to run single tests, as opposed to the entire suite. Given a single test, our rationale was that this is a minor inconvenience and would only impact multi-tab scenarios. We could have missed something, and I'd love to know a bit more about this so we can find a better solution.

@sublimator: If I understand correctly, your extension tests check for behavior between tabs/windows and mixing the two can get confusing. Did I get this right?

The tests are behaving so weird now :(

@shirshak55: Can you tell me a bit more about this?

Hello I don't think it only impact headful. Headless will consume more cpu, more ram just because of window. I just did a simple benchmark

Without tab

➜  code ps aux | grep firefox
shirshak         19076   1.1  5.7

With Tab

➜  code ps aux | grep firefox
shirshak         19076  21.0  9.3

5.7 for tab and 9.3% usage for window.

It same browser just with tab vs window. Making Multiple window definitely consumes way too much memory at least in headful mode. (It would be great if other can also post some benchmark but currently i am on laptop so can't give accurate benchmark)

By the way my issue is same context is giving tab when i use chrome and when i use Firefox it gives new window. Its inconsistent .

And We use playwright to not test but also automate workflow. So it would be great if we are given ability to choose whether we are going for tab or window is better. At least with context i assumes it should open new tab instead of window when i do newPage?

@arjunattam

Thank you very much for your question! :)

Ideally we would like to be able to test the extension's reactions to switching tabs inside a single window, which for us is definitely different to 1:1 tab:window scenarios.

On the topic of extension testing, while I have your attention, would it be possible to get some love on this issue:
https://github.com/microsoft/playwright/issues/3932

I'm currently sticking to 1.3.x until that issue (loading extensions into Firefox) is resolved.

Plus we run test sometime in vnc server just to know whats happening. In vnc i only notice one window so making multi tab is better there and multi window will be mess. Usually i don't care about headless but in head ful we need tab for sure :)

Was this page helpful?
0 / 5 - 0 ratings