Skip to main content

externalabstractBrowsingSession <Page_Type>

Represents the pages open in the current browsing context.

You'll need to use this class directly only if you're planning to integrate Serenity/JS with a new Web integration tool.

Index

Constructors

externalconstructor

Methods

externalclosePagesOtherThan

  • closePagesOtherThan(pageOfInterest: Page_Type): Promise<void>
  • Parameters

    • externalpageOfInterest: Page_Type

    Returns Promise<void>

publicexternalabstractbrowserCapabilities

externalcurrentPage

  • currentPage(): Promise<Page_Type>
  • Returns a Page representing the currently active top-level browsing context.


    Returns Promise<Page_Type>

externalregister

  • register(...pages: Page_Type[]): void
  • Registers specified pages to be managed by this BrowsingSession.


    Parameters

    • externalrest...pages: Page_Type[]

    Returns void

externalderegister

  • deregister(...pageIds: CorrelationId[]): void
  • Informs this BrowsingSession that it should no longer manage pages identified by the given pageIds.


    Parameters

    • externalrest...pageIds: CorrelationId[]

    Returns void

externalallPages

  • allPages(): Promise<Page_Type[]>
  • Returns a pages representing all the available top-level browsing context, e.g. all the open browser tabs.


    Returns Promise<Page_Type[]>

externalregisteredPageIds

  • registeredPageIds(): CorrelationId[]

externalchangeCurrentPageTo

  • changeCurrentPageTo(page: Page_Type): Promise<void>
  • Informs the BrowsingSession that the "current page" has changed to page.

    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: Page_Type

    Returns Promise<void>

externalcloseAllPages

  • closeAllPages(): Promise<void>
  • Closes all the pages available in this browsing context


    Returns Promise<void>