Share this page

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

C# Syntax

    public class XPathDescription : HP.LFT.SDK.PropertiesDescription, HP.LFT.SDK.IDescription

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
--- | --- | ---
| XPathDescription Constructor | Overloaded. Initializes a new instance of the XPathDescription class.

Top
Public Methods

| Name | Description
--- | --- | ---
| Clone | Creates an exact copy of the test object. (Inherited from HP.LFT.SDK.PropertiesDescription )
| ToString | ToString override. The string representation of this XPathDescription object.

Top
Public Operators

Implicit Type Conversion | Implicit cast of the specified string to an XPathDescription.

Top

Tips to improve your search results... OpenText™ Functional Testing for Developers .NET SDK Version: 25.2 OpenText™ Functional Testing for Developers SDK 25.2 All View Local Help Center View Online Help Center Version: