Share this page

# By Class

Contains all UFT Developer for Selenium By methods for locating elements.

## C# syntax

    public class By : OpenQA.Selenium.By

## Inheritance hierarchy

    OpenQA.Selenium.By
            LeanFT.Selenium.By

Namespace: LeanFT.Selenium

Assembly: LeanFTForSelenium

The LeanFT.Selenium.By class exposes the following members:

## Method summary

| Name | Description
--- | --- | ---
| Attribute(System.String, System.String) | Returns a locator that locates elements according to a single attribute.
| Attribute(System.String, System.Text.RegularExpressions.Regex) | Returns a locator that locates elements according to a single attribute, described using a regular expression.
| Attributes(System.Collections.Generic.IDictionary{System.String, System.Object}) | Returns a locator that locates elements according to one or more attributes. You can also use regular expressions.
| ClassName(System.Text.RegularExpressions.Regex) | Returns a locator that locates elements by the specified className, described using regular expression.
| Id(System.Text.RegularExpressions.Regex) | Returns a locator that locates elements by the specified ID, described using a regular expression.
| LinkText(System.Text.RegularExpressions.Regex) | Returns a locator that locates elements by the specified linkText, described using a regular expression.
| Name(System.Text.RegularExpressions.Regex) | Returns a locator that locates elements by the specified name, described using a regular expression.
| Role(System.String) | Returns a locator that locates elements by the specified role.
| Role(System.Text.RegularExpressions.Regex) | Returns a locator that locates elements by the specified role, described using a regular expression.
| Style(System.String, System.String) | Returns a locator that locates elements according to a single style.
| Style(System.String, System.Text.RegularExpressions.Regex) | Returns a locator that locates elements according to a single style, described using a regular expression.
| Styles(System.Collections.Generic.IDictionary{System.String, System.Object}) | Returns a locator that locates elements according to one or more styles. You can also use regular expressions.
| TagName(System.Text.RegularExpressions.Regex) | Returns a locator that locates elements by the specified tagName, described using a regular expression.
| Type(System.String) | Returns a locator that locates elements by the specified type.
| Type(System.Text.RegularExpressions.Regex) | Returns a locator that locates elements by the specified type, described using a regular expression.
| Visible(System.Boolean) | Returns a locator that locates elements that are either visible or not, depending on the parameter passed.
| VisibleText(System.String) | Returns a locator that locates elements by the specified visibleText.
| VisibleText(System.Text.RegularExpressions.Regex) | Returns a locator that locates element by the specified visibleText, described using a regular expression.

Back to top

## By.Attribute(System.String, System.String)

Returns a locator that locates elements according to a single attribute.

C# Syntax

    public static By Attribute(String name, String value)

Parameters

name. The name of the attribute.

value. The value of the attribute.

Returns

A locator that locates elements that have the specified attribute value.

Return Type

A By object

Back to top

## By.Attribute(System.String, System.Text.RegularExpressions.Regex)

Returns a locator that locates elements according to a single attribute, described using a regular expression.

C# Syntax

    public static By Attribute(String name, Regex value)

Parameters

name. The name of the attribute.

value. The Pattern of the attribute.

Returns

A locator that locates elements whose attribute value matches the specified pattern.

Return Type

A By object

Back to top

## By.Attributes(System.Collections.Generic.IDictionary{System.String, System.Object})

Returns a locator that locates elements according to one or more attributes. You can also use regular expressions.

C# Syntax

    public static By Attributes(IDictionary attributes)

Parameters

attributes. Dictionary of attributes.

Returns

A locator that locates elements by their attributes.

Return Type

A By object

Back to top

## By.ClassName(System.Text.RegularExpressions.Regex)

Returns a locator that locates elements by the specified className, described using a regular expression.

C# Syntax

    public static By ClassName(Regex className)

Parameters

className. The className of the elements in the form of a regular expression.

Returns

A locator that locates elements with the specified className.

Return Type

A By object

Back to top

## By.Id(System.Text.RegularExpressions.Regex)

Returns a locator that locates elements by the specified ID, described using a regular expression.

C# Syntax

    public static By Id(Regex id)

Parameters

id. The ID of the elements in the form of a regular expression.

Returns

A locator that locates elements with the specified ID.

Return Type

A By object

Back to top

## By.LinkText(System.Text.RegularExpressions.Regex)

Returns a locator that locates elements by the specified linkText, described using a regular expression.

C# Syntax

    public static By LinkText(Regex linkText)

Parameters

linkText. The linkText of the elements in the form of a regular expression.

Returns

A locator that locates elements with the specified linkText.

Return Type

A By object

Back to top

## By.Name(System.Text.RegularExpressions.Regex)

Returns a locator that locates elements by the specified name, described using a regular expression.

C# Syntax

    public static By Name(Regex name)

Parameters

Name. The name of the elements in the form of a regular expression.

Returns

A locator that locates elements with the given name.

Return Type

A By object

Back to top

## By.Role(System.String)

Returns a locator that locates elements by the specified role.

C# Syntax

    public static By Role(String role)

Parameters

role. The role of the elements.

Returns

A locator that locates elements with the specified role.

Return Type

A By object

Back to top

## By.Role(System.Text.RegularExpressions.Regex)

Returns a locator that locates elements by the specified role, described using a regular expression.

C# Syntax

    public static By Role(Regex role)

Parameters

role. The role of the elements in the form of a regular expression.

Returns

A locator that locates elements with the specified role.

Return Type

A By object

Back to top

## By.Style(System.String, System.String)

Returns a locator that locates elements according to a single style.

C# Syntax

    public static By Style(String name, String value)

Parameters

name. The name of the style.

value. The value of the style.

Returns

A locator that locates elements with the specified style.

Return Type

A By object

Back to top

## By.Style(System.String, System.Text.RegularExpressions.Regex)

Returns a locator that locates elements according to a single style, described using a regular expression.

C# Syntax

    public static By Style(String name, Regex value)

Parameters

name. The name of the style.

value. The Pattern of the style.

Returns

A locator that locates elements whose style matches the specified pattern.

Return Type

A By object

Back to top

## By.Styles(System.Collections.Generic.IDictionary{System.String, System.Object})

Returns a locator that locates elements according to one or more styles. You can also use regular expressions.

C# Syntax

    public static By Styles(IDictionary styles)

Parameters

styles. Dictionary of styles.

Returns

A locator that locates elements by their styles.

Return Type

A By object

Back to top

## By.TagName(System.Text.RegularExpressions.Regex)

Returns a locator that locates elements by the specified tagName, described using a regular expression.

C# Syntax

    public static By TagName(Regex tagName)

Parameters

tagName. The tagName of the elements in the form of a regular expression.

Returns

A locator that locates elements with the specified tagName.

Return Type

A By object

Back to top

## By.Type(System.String)

Returns a locator that locates elements by the specified type.

C# Syntax

    public static By Type(String type)

Parameters

type. The type of the elements.

Returns

A locator that locates elements with the specified type.

Return Type

A By object

Back to top

## By.Type(System.Text.RegularExpressions.Regex)

Returns a locator that locates elements by the specified regular expression type.

C# Syntax

    public static By Type(Regex type)

Parameters

type. The type of the elements in the form of a regular expression.

Returns

A locator that locates elements with the specified type.

Return Type

A By object

Back to top

## By.Visible(System.Boolean)

Returns a locator that locates elements that are either visible or not, depending on the parameter passed.

C# Syntax

    public static By Visible(Boolean visible)

Parameters

visible. Whether the elements are visible.

Returns

A locator that locates elements that are either visible or not, depending on the parameter passed.

Return Type

A By object

Back to top

## By.VisibleText(System.String)

Returns a locator that locates elements by the specified visibleText.

C# Syntax

    public static By VisibleText(String visibleText)

Parameters

visibleText. The visible text of the elements.

Returns

A locator that locates elements whose visible text matches the specified text.

Return Type

A By object

Back to top

## By.VisibleText(System.Text.RegularExpressions.Regex)

Returns a locator that locates element by the specified visibleText, described using a regular expression.

C# Syntax

    public static By VisibleText(Regex visibleText)

Parameters

visibleText. The visible text of the elements in the form of a regular expression.

Returns

A locator that locates elements whose visible text matches the specified text.

Return Type

A By object

Back to top

See also:

- LeanFT.Selenium Namespace

Tips to improve your search results... UFT Developer for Selenium SDK (.NET) Reference Version 15.0-15.0.2 UFT Developer SDK Reference All View Local Help Center View Online Help Center back Go back in browser history forward Go forward in browser history Remove search highlights next topic Go to next topic previous topic Go to previous topic Print the current topic Version: