XPathDescription Class
The description of a Web test object based on the object’s XPath.

C# Syntax

Example
[Test]
public void verify_InnerText()
{
    // Open the Chrome browser.
    var browser = BrowserFactory.Launch(BrowserType.Chrome);

    // Use Try/Catch to add a warning to the run report if the assert validation fails.
    try
    {
        // Navigate to the New Tours website. 
        browser.Navigate("https://www.advantageonlineshopping.com/");

        // Locate the link object using its XPath.
        var speakersCategoryLink = browser.Describe<ILink>(new XPathDescription("//DIV[@id=\"speakersImg\"]"));

        // Verify the innerText value.
        Assert.AreEqual("SPEAKERS Shop Now ", speakersCategoryLink.InnerText);
    }
    catch (Exception e)
    // Use a ReportEvent step to add details to the results report if there is an error in the test.
    {
        Reporter.ReportEvent("verify_innerTextIsPresented", "Failed during validation", Status.Failed, e);
        throw;
    }
    finally
    {
        browser.Close();
    }
}
Inheritance Hierarchy

System.Object
   HP.LFT.SDK.PropertiesDescription
      HP.LFT.SDK.Web.XPathDescription

Public Constructors
  Name Description
Public Constructor XPathDescription Constructor Overloaded. Initializes a new instance of the XPathDescription class.  
Top
Public Methods
  Name Description
Public Method Clone Creates an exact copy of the test object. (Inherited from HP.LFT.SDK.PropertiesDescription )
Public Method ToString ToString override. The string representation of this XPathDescription object.  
Top
Public Operators
public Operator Implicit Type Conversion Implicit cast of the specified string to an XPathDescription.
Top