Open topic with navigation

Attach Method (BrowserFactory)
Returns a new IBrowser instance that is attached to a browser tab that was not opened by LeanFT (for example, a browser tab that was opened manually or by the AUT).
Remarks
BrowserDescription is used only when attaching to the browser so transient properties like BrowserDescription.Url and BrowserDescription.Title can be used.
LeanFT recognizes browser windows and tabs that it opens (for example, via Launch(BrowserType)). If a browser is opened outside of the LeanFT context, you need to use the Attach method to acquire the browser tab or window.
Examples:
- A browser tab was opened manually while setting up a scenario prior to running a LeanFT test.
- A test step clicks a link in the AUT that opens a new or replacement browser tab or window.

C# Syntax

    public static IBrowser Attach(
       BrowserDescription description
    )

Parameters

description
  BrowserDescription for filtering the open tabs.

Return Value

IBrowser for the launched browser if a single matching browser was found.
Example

    // Use "Attach" to connect a new (or replacement) browser tab with the LeanFT test.
    IBrowser aboutTab = BrowserFactory.Attach(new BrowserDescription
    {
        Title = "Cruises: Mercury Tours"
    });

Exceptions

Exception | Description
--- | ---
HP.LFT.SDK.ReplayObjectNotFoundException | No open browser tab matches the description.
HP.LFT.SDK.ReplayObjectNotUniqueException | More than one browser tab matches the description.