HttpWatch Automation Reference - Version 15.x
HttpWatch Namespace / Controller Class / AttachByTitle Method
Specifies the title of the web page in an existing instance of  Google Chrome or Microsoft Edge to which you want to attach HttpWatch. The page title is case sensitive.

In This Topic
    AttachByTitle Method
    In This Topic
    Syntax
    'Declaration
     
    Public Function AttachByTitle( _
       ByVal pageTitle As String _
    ) As Plugin
    public Plugin AttachByTitle( 
       string pageTitle
    )

    Parameters

    pageTitle
    Specifies the title of the web page in an existing instance of  Google Chrome or Microsoft Edge to which you want to attach HttpWatch. The page title is case sensitive.

    Return Value

    Returns a reference to the Plugin object representing the HttpWatch add-on in the target browser instance.

    An error is returned if no matching page titles were found or if any duplicates where detected.

    Remarks

    To avoid clashing with existing pages loaded in Edge or Chrome use a unique page title with AttachByTitle. In Selenium this can be achieved by executing JavaScript in the new browser instance: 

    Using AttachByTitle with a unique title in Selenium
    Copy Code
    IWebDriver driver = <Create Selenium Driver using existing profile>;
    
    // Set a unique initial page title so that HttpWatch can attach to it
    string uniqueTitle = Guid.NewGuid().ToString();
    IJavaScriptExecutor js = driver as IJavaScriptExecutor;
    js.ExecuteScript("document.title = '" + uniqueTitle + "';");
    
    // Attach HttpWatch to the instance of the browser created through Selenium
    Plugin plugin = control.AttachByTitle(uniqueTitle);
    
    Requirements
     
    See Also