microsoft / playwright

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
https://playwright.dev
Apache License 2.0
66.78k stars 3.66k forks source link

[Question]: Is there a way to check which page/tab is currently active/visible on a given context ? #8090

Closed sandratreneska closed 3 years ago

sandratreneska commented 3 years ago

Your question

Hello,

In a multi-page scenario I need to find which page/tab is currently active/visible on a given context. In my application, a user can (non-programmatically) click on or open new tabs, and I need to know what is the currently opened (visible) tab.

aslushnikov commented 3 years ago

In my application, a user can (non-programmatically) click on or open new tabs, and I need to know what is the currently opened (visible) tab.

This is not a scenario that we support right now - we focus on testing / webautomation.

In a multi-page scenario I need to find which page/tab is currently active/visible on a given context.

In playwright-controlled browser, all pages are "focused" - so that's probably not what you want.