IElementWeb
IElementWeb
is a representation of the browsers HTML element.
// Your driver referencevar driver = DriverBuilder.Create(new WebDriverOptions());
// Access an IElementWeb by calling GetElementvar element = await driver.GetElement("#element-selector");
Properties
Section titled “Properties”Description: The inner text of the current element
Type: string
IsDisplayed
Section titled “IsDisplayed”Description: Whether the current element is displayed on the page
Type: bool
ClassName
Section titled “ClassName”Description: The elements class name
Type: string
Description: The elements id
Type: string
Description: The elements tag name
Type: string
Methods
Section titled “Methods”Description: Type the provided text into the current element
Arguments: string
Returns: Task
await element.Type("Typing some text");
PressKeys
Section titled “PressKeys”Description: Mimic a user “press” of the provided keys.
Arguments: Keys
Returns: Task
await element.PressKeys(Keys.S);
Description: Invoke a click event
Returns: Task
await element.Click();
RightClick
Section titled “RightClick”Description: Invoke a right-click event
Returns: Task
await element.RightClick();
DoubleClick
Section titled “DoubleClick”Description: Invoke a double-click event
Returns: Task
await element.DoubleClick();
ClickAndHold
Section titled “ClickAndHold”Description: Click and hold the current element
Arguments: TimeSpan
Returns: Task
await element.ClickAndHold(TimeSpan.FromSeconds(2));
GetAttributeValue
Section titled “GetAttributeValue”Description: Get the value of a HTML attribute from its specified name
Arguments: TimeSpan
Returns: Task<string>
var elementValue = await element.GetAttributeValue("value");
ScrollTo
Section titled “ScrollTo”Description: Scroll to and get the specified element
Arguments: string
Returns: Task<IElementWeb>
var scrolledToElement = await element.ScrollTo("#scrolled-to-element-selector");