externalabstractPlaywrightBrowsingSession
Hierarchy
- BrowsingSession<PlaywrightPage>
- PlaywrightBrowsingSession
Index
Methods
publicexternalabstractbrowserCapabilities
Returns basic meta-data about the browser associated with this ability.
Please note that since Playwright does not expose information about the operating system the tests are running on, Serenity/JS assumes that the tests are running locally and therefore returns the value of Node.js
process.platform
forplatformName
.Returns Promise<BrowserCapabilities>
externalcookie
Parameters
externalname: string
Returns Promise<Cookie>
externalsetCookie
Parameters
externalcookie: CookieData
Returns Promise<void>
externaldeleteAllCookies
Returns Promise<void>
externalclosePagesOtherThan
Parameters
externalpageOfInterest: PlaywrightPage
Returns Promise<void>
externalcurrentPage
Returns a
Page
representing the currently active top-level browsing context.Returns Promise<PlaywrightPage>
externalregister
Registers specified pages to be managed by this
BrowsingSession
.Parameters
externalrest...pages: PlaywrightPage[]
Returns void
externalderegister
Informs this
BrowsingSession
that it should no longer manage pages identified by the givenpageIds
.Parameters
externalrest...pageIds: CorrelationId[]
Returns void
externalallPages
Returns a pages representing all the available top-level browsing context, e.g. all the open browser tabs.
Returns Promise<PlaywrightPage[]>
externalregisteredPageIds
Returns the ids of any pages this
BrowsingSession
is aware of.Returns CorrelationId[]
externalchangeCurrentPageTo
Informs the
BrowsingSession
that the "current page" has changed topage
.Please note that different Web integration tools have a different definition of what a "current page" is. For example, Selenium or WebdriverIO use a single "focused" window that a developer needs to explicitly "switch to" in their tests in order to interact with it. This is similar to how a regular user would interact with Web pages; switching from one tab to another, but not interacting with more than one window/tab simultaneously.
Playwright and Puppeteer, on the other hand, don't have a concept of the "current" page at all, since they allow the developer to interact with multiple open tabs/windows at the same time.
Web integration-specific implementations of this class should override this method to define how the concept of the "current page" should be interpreted by Serenity/JS.
Parameters
externalpage: PlaywrightPage
Returns Promise<void>
externalcloseAllPages
Closes all the pages available in this browsing context
Returns Promise<void>
Playwright-specific implementation of
BrowsingSession
.