Browser.connect() returns a Browser. browser.page is the tab the session
opened on.
with block closes the connection; the session keeps running.
browser.page
The tab the session was showing when you connected.
Returns Page.
browser.new_page()
Open a new tab, on url or blank.
Page.
browser.contexts
The session’s contexts. A session is one browser profile, so this always has one entry.
Returns list[BrowserContext].
browser.new_context()
Return the session’s one context. Options are accepted and ignored, so
Playwright code that creates a context runs unchanged.
Returns BrowserContext.
browser.capabilities
The DCP methods this session serves, from the handshake.
Returns list[str], such as ["Locator.click", "Page.evaluate", ...].
browser.device
What the session runs on, from the handshake.
Returns dict.
browser.handshake
The full Protocol.handshake result. See Protocol.handshake.
Returns dict.
browser.version()
The browser’s product string.
Returns str: the browser product and version.
browser.is_connected()
Whether the connection is still open.
Returns bool.
browser.close()
Close the connection. The session keeps running until it is stopped.
On computer.browser
it does nothing: the connection is the computer’s, and closes with it.