Skip to content

RelativeBy

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

// find an input element above the password field
var by = RelativeBy.WithLocator(By.XPath("//input")).Above(By.XPath("//input[@id='password']"));
var el = WebDriver.FindElement(by);
// or
var anchorElement = WebDriver.FindElementByXPath("//input[@id='password'"]);
var by = RelativeBy.WithLocator(By.XPath("//input")).Above(anchorElement);
var el = WebDriver.FindElement(by);

Action Summary

Action Description
Above Creates RelativeBy.Above selector.
Below Creates RelativeBy.Below selector.
LeftOf Creates RelativeBy.LeftOf selector.
Near Creates RelativeBy.Near selector.
RightOf Creates RelativeBy.RightOf selector.
WithLocator Creates RelativeBy.WithLocator selector.

Action Detail

Above

Creates RelativeBy.Above selector.

WebDriver.Above(byOrElement)

Parameters:

Name Type Description
byOrElement By By or WebElementWrapper object.

Returns:

RelativeBy object.

Below

Creates RelativeBy.Below selector.

WebDriver.Below(byOrElement)

Parameters:

Name Type Description
byOrElement By By or WebElementWrapper object.

Returns:

RelativeBy object.

LeftOf

Creates RelativeBy.LeftOf selector.

WebDriver.LeftOf(byOrElement)

Parameters:

Name Type Description
byOrElement By By or WebElementWrapper object.

Returns:

RelativeBy object.

Near

Creates RelativeBy.Near selector.

WebDriver.Near(byOrElement, atMostDistanceInPixels)

Parameters:

Name Type Description
byOrElement By By or WebElementWrapper object.
atMostDistanceInPixels number Distance in pixels.
Optional, Default: "50".

Returns:

RelativeBy object.

RightOf

Creates RelativeBy.RightOf selector.

WebDriver.RightOf(byOrElement)

Parameters:

Name Type Description
byOrElement By By or WebElementWrapper object.

Returns:

RelativeBy object.

WithLocator

Creates RelativeBy.WithLocator selector.

WebDriver.WithLocator(by)

Parameters:

Name Type Description
by By By object.

Returns:

RelativeBy object.