Skip to content

WebElementWrapper

This is a JavaScript wrapper for RemoteWebElement of Selenium .NET library. For code complete feature use class name WebElementWrapper, e.g.

var /**WebElementWrapper*/el = WebDriver.FindElementById('username');

Action Summary

Action Description
Clear Clears the content of this element.
Click Clicks this element.
ClickAt Clicks this element at the specified location.
ContextClick Opens context menu for this element.
DoubleClick Performs double click on this element.
FindElementByClassName Finds the first element in the page that matches the CSS Class supplied.
FindElementByCssSelector Finds the first element matching the specified CSS selector.
FindElementById Finds the first element in the page that matches the ID supplied.
FindElementByLinkText Finds the first of elements that match the link text supplied.
FindElementByName Finds the first of elements that match the name supplied.
FindElementByPartialLinkText Finds the first of elements that match the part of the link text supplied.
FindElementByTagName Finds the first of elements that match the DOM Tag supplied.
FindElementByXPath Finds the first of elements that match the XPath supplied.
FindElementsByClassName Finds a list of elements that match the class name supplied.
FindElementsByCssSelector Finds all elements matching the specified CSS selector.
FindElementsById Finds the first element in the page that matches the ID supplied.
FindElementsByLinkText Finds a list of elements that match the link text supplied.
FindElementsByName Finds a list of elements that match the name supplied.
FindElementsByPartialLinkText Finds a list of elements that match the part of the link text supplied.
FindElementsByTagName Finds a list of elements that match the DOM Tag supplied.
FindElementsByXPath Finds a list of elements that match the XPath supplied.
GetAttribute Gets the value of the specified attribute for this element.
GetCoordinates Gets a 'Point' object containing the coordinates of the
upper-left corner of this element relative to the upper-left
corner of the page.
GetCssValue Gets the value of a CSS property of this element.
GetDisplayed Gets a value indicating whether or not this element is displayed.
GetEnabled Gets a value indicating whether or not this element is enabled.
GetHashCode Method to get the hash code of the element.
GetId Gets internal element id.
GetLocation Gets a 'Point' object containing the coordinates of the
upper-left corner of this element relative to the upper-left
corner of the page.
GetLocationOnScreenOnceScrolledIntoView Gets the point where the element would be when scrolled into view.
GetScreenshotIW Gets screenshot of the element.
GetSelected Gets a value indicating whether or not this element is selected.
GetSize Gets a 'Size' object containing the height and width of this element.
GetTagName Gets the tag name of this element.
GetText Gets the innerText of this element, without any leading or
trailing whitespace, and with other whitespace collapsed.
SelectOptionByText Selects option from select element.
SendKeys Simulates typing text into the element.
Submit Submits this element to the web server.

Action Detail

Clear

Clears the content of this element.

WebDriver.FindElementById('username').Clear()

Click

Clicks this element.

WebDriver.FindElementById('username').Click()

ClickAt

Clicks this element at the specified location.

WebDriver.FindElementById('username').ClickAt(x, y)

Parameters:

Name Type Description
x number
y number

ContextClick

Opens context menu for this element.

WebDriver.FindElementById('username').ContextClick()

DoubleClick

Performs double click on this element.

WebDriver.FindElementById('username').DoubleClick()

FindElementByClassName

Finds the first element in the page that matches the CSS Class supplied.

WebDriver.FindElementById('username').FindElementByClassName(className)

Parameters:

Name Type Description
className string CSS class name of the element.

Returns:

WebElementWrapper: element or null.

FindElementByCssSelector

Finds the first element matching the specified CSS selector.

WebDriver.FindElementById('username').FindElementByCssSelector(cssSelector)

Parameters:

Name Type Description
cssSelector string The CSS selector to match.

Returns:

WebElementWrapper: element ot null.

FindElementById

Finds the first element in the page that matches the ID supplied.

WebDriver.FindElementByTagName('section').FindElementById('h3')

Parameters:

Name Type Description
id string ID of the element.

Returns:

WebElementWrapper: element or null.

FindElementByLinkText

Finds the first of elements that match the link text supplied.

WebDriver.FindElementById('username').FindElementByLinkText(linkText)

Parameters:

Name Type Description
linkText string Link text of element.

Returns:

WebElementWrapper: element or null.

FindElementByName

Finds the first of elements that match the name supplied.

WebDriver.FindElementById('username').FindElementByName(name)

Parameters:

Name Type Description
name string Name of the element on the page.

Returns:

WebElementWrapper: element or null.

FindElementByPartialLinkText

Finds the first of elements that match the part of the link text supplied.

WebDriver.FindElementById('username').FindElementByPartialLinkText(partialLinkText)

Parameters:

Name Type Description
partialLinkText string Part of the link text.

Returns:

WebElementWrapper: element or null.

FindElementByTagName

Finds the first of elements that match the DOM Tag supplied.

WebDriver.FindElementById('username').FindElementByTagName(tagName)

Parameters:

Name Type Description
tagName string DOM tag Name of the element being searched.

Returns:

WebElementWrapper: element or null.

FindElementByXPath

Finds the first of elements that match the XPath supplied.

WebDriver.FindElementById('username').FindElementByXPath(xpath)

Parameters:

Name Type Description
xpath string xpath to the element.

Returns:

WebElementWrapper: element or null.

FindElementsByClassName

Finds a list of elements that match the class name supplied.

WebDriver.FindElementById('username').FindElementsByClassName(className)

Parameters:

Name Type Description
className string className of the element.

Returns:

WebElementWrapper: array of elements.

FindElementsByCssSelector

Finds all elements matching the specified CSS selector.

WebDriver.FindElementById('username').FindElementsByCssSelector(cssSelector)

Parameters:

Name Type Description
cssSelector string The CSS selector to match.

Returns:

WebElementWrapper: array of elements.

FindElementsById

Finds the first element in the page that matches the ID supplied.

WebDriver.FindElementById('username').FindElementsById(id)

Parameters:

Name Type Description
id string ID of the element.

Returns:

WebElementWrapper: array of elements.

FindElementsByLinkText

Finds a list of elements that match the link text supplied.

WebDriver.FindElementById('username').FindElementsByLinkText(linkText)

Parameters:

Name Type Description
linkText string Link text of element.

Returns:

WebElementWrapper: array of elements.

FindElementsByName

Finds a list of elements that match the name supplied.

WebDriver.FindElementById('username').FindElementsByName(name)

Parameters:

Name Type Description
name string Name of the element on the page.

Returns:

WebElementWrapper: array of elements.

FindElementsByPartialLinkText

Finds a list of elements that match the part of the link text supplied.

WebDriver.FindElementById('username').FindElementsByPartialLinkText(partialLinkText)

Parameters:

Name Type Description
partialLinkText string Part of the link text.

Returns:

WebElementWrapper: array of elements.

FindElementsByTagName

Finds a list of elements that match the DOM Tag supplied.

WebDriver.FindElementById('username').FindElementsByTagName(tagName)

Parameters:

Name Type Description
tagName string DOM tag Name of the element being searched.

Returns:

WebElementWrapper: array of elements.

FindElementsByXPath

Finds a list of elements that match the XPath supplied.

WebDriver.FindElementById('username').FindElementsByXPath(xpath)

Parameters:

Name Type Description
xpath string xpath to the element.

Returns:

WebElementWrapper: array of elements.

GetAttribute

Gets the value of the specified attribute for this element.

WebDriver.FindElementById('username').GetAttribute(attributeName)

Parameters:

Name Type Description
attributeName

GetCoordinates

Gets a 'Point' object containing the coordinates of the upper-left corner of this element relative to the upper-left corner of the page.

WebDriver.FindElementById('username').GetCoordinates()

GetCssValue

Gets the value of a CSS property of this element.

WebDriver.FindElementById('username').GetCssValue(propertyName)

Parameters:

Name Type Description
propertyName

GetDisplayed

Gets a value indicating whether or not this element is displayed.

WebDriver.FindElementById('username').GetDisplayed()

GetEnabled

Gets a value indicating whether or not this element is enabled.

WebDriver.FindElementById('username').GetEnabled()

GetHashCode

Method to get the hash code of the element.

WebDriver.FindElementById('username').GetHashCode()

GetId

Gets internal element id.

WebDriver.FindElementById('username').GetId()

GetLocation

Gets a 'Point' object containing the coordinates of the upper-left corner of this element relative to the upper-left corner of the page.

WebDriver.FindElementById('username').GetLocation()

GetLocationOnScreenOnceScrolledIntoView

Gets the point where the element would be when scrolled into view.

WebDriver.FindElementById('username').GetLocationOnScreenOnceScrolledIntoView()

GetScreenshotIW

Gets screenshot of the element.

WebDriver.FindElementById('username').GetScreenshotIW()

GetSelected

Gets a value indicating whether or not this element is selected.

WebDriver.FindElementById('username').GetSelected()

GetSize

Gets a 'Size' object containing the height and width of this element.

WebDriver.FindElementById('username').GetSize()

GetTagName

Gets the tag name of this element.

WebDriver.FindElementById('username').GetTagName()

GetText

Gets the innerText of this element, without any leading or trailing whitespace, and with other whitespace collapsed.

WebDriver.FindElementById('username').GetText()

SelectOptionByText

Selects option from select element.

WebDriver.FindElementById('username').SelectOptionByText(option)

Parameters:

Name Type Description
option

SendKeys

Simulates typing text into the element.

WebDriver.FindElementById('username').SendKeys(text)

Parameters:

Name Type Description
text

Submit

Submits this element to the web server.

WebDriver.FindElementById('username').Submit()