Table of Contents

Class XPath

Namespace
CSF.Screenplay.Selenium.Elements
Assembly
CSF.Screenplay.Selenium.dll

Concrete implementation of Locator which locates elements using an XPath query.

public class XPath : Locator, ITarget, IHasName
Inheritance
XPath
Implements
Inherited Members
Extension Methods

Remarks

This class wraps Selenium's XPath(string) functionality. The purpose is provide a type which derives from ITarget, compatible with the Selenium extension's performables. This class also provides opportunity to add a human-readable Name to the element specification. This optional, but recommended, technique improves the readability of Screenplay reports.

Constructors

XPath(string, string)

Initializes a new instance of the XPath class.

public XPath(string xpath, string name = null)

Parameters

xpath string

The XPath query by which to locate elements.

name string

An optional human-readable name of the locator which describes the elements it matches.

Methods

GetDefaultName()

Gets a value for Name if none has been specified.

protected override string GetDefaultName()

Returns

string

A default name

GetLocator()

Gets the Selenium locator instance for finding HTML elements.

public override By GetLocator()

Returns

By

A Selenium By object used to locate elements.