Skip to content

By

This is a JavaScript wrapper for By of Selenium .NET library. Requires Rapise 8.3+. Examples:

var by = By.XPath("//input[@id='username']");
var el = WebDriver.FindElement(by);
// is an alternative to
var el = WebDriver.FindElementByXPath("//input[@id='username']");
var by = By.XPath("//input");
var els = WebDriver.FindElements(by);
// is an alternative to
var els = WebDriver.FindElementsByXPath("//input");

Action Summary

Action Description
ClassName Creates By.ClassName selector.
CssSelector Creates By.CssSelector selector.
Id Creates By.Id selector.
LinkText Creates By.LinkText selector.
Name Creates By.Name selector.
PartialLinkText Creates By.PartialLinkText selector.
TagName Creates By.TagName selector.
XPath Creates By.XPath selector.

Action Detail

ClassName

Creates By.ClassName selector.

WebDriver.ClassName(classNameToFind)

Parameters:

Name Type Description
classNameToFind string Class name to find.

Returns:

By object.

CssSelector

Creates By.CssSelector selector.

WebDriver.CssSelector(cssSelectorToFind)

Parameters:

Name Type Description
cssSelectorToFind string CSS selector to find.

Returns:

By object.

Id

Creates By.Id selector.

WebDriver.Id(idToFind)

Parameters:

Name Type Description
idToFind string Id to find.

Returns:

By object.

LinkText

Creates By.LinkText selector.

WebDriver.LinkText(linkTextToFind)

Parameters:

Name Type Description
linkTextToFind string Link text to find.

Returns:

By object.

Name

Creates By.Name selector.

WebDriver.Name(nameToFind)

Parameters:

Name Type Description
nameToFind string Name to find.

Returns:

By object.

PartialLinkText

Creates By.PartialLinkText selector.

WebDriver.PartialLinkText(partialLinkTextToFind)

Parameters:

Name Type Description
partialLinkTextToFind string Partial link text to find.

Returns:

By object.

TagName

Creates By.TagName selector.

WebDriver.TagName(tagNameToFind)

Parameters:

Name Type Description
tagNameToFind string TagName to find.

Returns:

By object.

XPath

Creates By.XPath selector.

WebDriver.XPath(xPathToFind)

Parameters:

Name Type Description
xPathToFind string XPath to find.

Returns:

By object.