HttpWatch Automation Reference - Version 11.x
HttpWatch Namespace / Controller Class / AttachByTitle Method
Specifies the title of the web page in an existing instance of  Internet Explorer  or Google Chrome 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  Internet Explorer  or Google Chrome 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

    AttachByTitle was added in version 8.4 and is the recommended way to integrate with the Selenium browser automation framework because it can be used with the IE drivers.

    To avoid clashing with existing pages loaded in IE 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>; // Don't use new FirefoxDriver()
    
    // 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