XPathDescription Class
The description of a Web test object based on the object’s XPath.
C# Syntax
public void verify_CurrentDateIsPresented()
    // Suppose you want to verify that the AUT's home page displays today's date, but the date label does not have identification properties, and the text is dynamic.
    // You can use the label's XPath to locate it and verify that the text represents the current date.
    // 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. 
        // Navigate to the New Tours website. 

        // Locate the label using its XPath.
        var dateLabel = browser.Describe<IWebElement>(new XPathDescription("/html/body/div/table/tbody/tr/td[2]/table/tbody/tr[4]/td/table/tbody/tr/td[2]/table/tbody/tr[2]/td[3]/form/table/tbody/tr[1]/td/font/b"));

        // Convert the date into .NET object.
        var presentedDate = DateTime.Parse(dateLabel.InnerText);

        // Verify that today's date matches the date displayed.
        Assert.AreEqual(DateTime.Now.Date, presentedDate.Date);
    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_CurrentDateIsPresented", "Failed during validation", Status.Failed, e);
Inheritance Hierarchy


Public Constructors
  Name Description
Public Constructor XPathDescription Constructor Overloaded. Initializes a new instance of the XPathDescription class.  
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.  
Public Operators
public Operator Implicit Type Conversion Implicit cast of the specified string to an XPathDescription.