C# Class OpenQA.Selenium.Remote.RemoteWebElement

RemoteWebElement allows you to have access to specific items that are found on the page
Inheritance: IWebElement, IFindsByLinkText, IFindsById, IFindsByName, IFindsByTagName, IFindsByClassName, IFindsByXPath, IFindsByPartialLinkText, IFindsByCssSelector, IWrapsDriver, ILocatable, ITakesScreenshot
ファイルを表示 Open project: asynchrony/Selenium2 Class Usage Examples

Private Properties

Property Type Description

Public Methods

Method Description
Clear ( ) : void

Method to clear the text out of an Input element

Click ( ) : void

Click this element. If this causes a new page to load, this method will block until the page has loaded. At this point, you should discard all references to this element and any further operations performed on this element will have undefined behaviour unless you know that the element and the page will still be present. If this element is not clickable, then this operation is a no-op since it's pretty common for someone to accidentally miss the target when clicking in Real Life

Equals ( object obj ) : bool

Compares if two elements are equal

FindElement ( By by ) : IWebElement

Finds the first element in the page that matches the By object

FindElementByClassName ( string className ) : IWebElement

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

FindElementByCssSelector ( string cssSelector ) : IWebElement

Finds the first element matching the specified CSS selector.

FindElementById ( string id ) : IWebElement

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

FindElementByLinkText ( string linkText ) : IWebElement

Finds the first of elements that match the link text supplied

FindElementByName ( string name ) : IWebElement

Finds the first of elements that match the name supplied

FindElementByPartialLinkText ( string partialLinkText ) : IWebElement

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

FindElementByTagName ( string tagName ) : IWebElement

Finds the first of elements that match the DOM Tag supplied

FindElementByXPath ( string xpath ) : IWebElement

Finds the first of elements that match the XPath supplied

FindElements ( By by ) : ReadOnlyCollection

Finds the elements on the page by using the By object and returns a ReadOnlyCollection of the Elements on the page

FindElementsByClassName ( string className ) : ReadOnlyCollection

Finds a list of elements that match the classname supplied

FindElementsByCssSelector ( string cssSelector ) : ReadOnlyCollection

Finds all elements matching the specified CSS selector.

FindElementsById ( string id ) : ReadOnlyCollection

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

FindElementsByLinkText ( string linkText ) : ReadOnlyCollection

Finds the first of elements that match the link text supplied

FindElementsByName ( string name ) : ReadOnlyCollection

Finds a list of elements that match the name supplied

FindElementsByPartialLinkText ( string partialLinkText ) : ReadOnlyCollection

Finds a list of elements that match the classname supplied

FindElementsByTagName ( string tagName ) : ReadOnlyCollection

Finds a list of elements that match the DOM Tag supplied

FindElementsByXPath ( string xpath ) : ReadOnlyCollection

Finds a list of elements that match the XPath supplied

GetAttribute ( string attributeName ) : string

If this current element is a form, or an element within a form, then this will be submitted to the remote server. If this causes the current page to change, then this method will block until the new page is loaded.

GetCssValue ( string propertyName ) : string

Method to return the value of a CSS Property

GetHashCode ( ) : int

Method to get the hash code of the element

RemoteWebElement ( RemoteWebDriver parentDriver, string id ) : System

Initializes a new instance of the RemoteWebElement class.

Select ( ) : void

Select or unselect element. This operation only applies to input elements such as checkboxes, options in a select and radio buttons.

SendKeys ( string text ) : void

Method for sending native key strokes to the browser

Submit ( ) : void

If this current element is a form, or an element within a form, then this will be submitted to the remote server. If this causes the current page to change, then this method will block until the new page is loaded.

Toggle ( ) : bool

If the element is a checkbox this will toggle the elements state from selected to not selected, or from not selected to selected

Protected Methods

Method Description
Execute ( DriverCommand commandToExecute, object>.Dictionary parameters ) : OpenQA.Selenium.Remote.Response

Executes a command on this element using the specified parameters.

FindElement ( string mechanism, string value ) : IWebElement

Finds a child element matching the given mechanism and value.

FindElements ( string mechanism, string value ) : ReadOnlyCollection

Finds all child elements matching the given mechanism and value.

Method Details

Clear() public method

Method to clear the text out of an Input element
public Clear ( ) : void
return void

Click() public method

Click this element. If this causes a new page to load, this method will block until the page has loaded. At this point, you should discard all references to this element and any further operations performed on this element will have undefined behaviour unless you know that the element and the page will still be present. If this element is not clickable, then this operation is a no-op since it's pretty common for someone to accidentally miss the target when clicking in Real Life
public Click ( ) : void
return void

Equals() public method

Compares if two elements are equal
public Equals ( object obj ) : bool
obj object Object to compare against
return bool

Execute() protected method

Executes a command on this element using the specified parameters.
protected Execute ( DriverCommand commandToExecute, object>.Dictionary parameters ) : OpenQA.Selenium.Remote.Response
commandToExecute DriverCommand The to execute against this element.
parameters object>.Dictionary A containing names and values of the parameters for the command.
return OpenQA.Selenium.Remote.Response

FindElement() public method

Finds the first element in the page that matches the By object
public FindElement ( By by ) : IWebElement
by By By mechanism to find the element
return IWebElement

FindElement() protected method

Finds a child element matching the given mechanism and value.
protected FindElement ( string mechanism, string value ) : IWebElement
mechanism string The mechanism by which to find the element.
value string The value to use to search for the element.
return IWebElement

FindElementByClassName() public method

Finds the first element in the page that matches the CSS Class supplied
public FindElementByClassName ( string className ) : IWebElement
className string className of the
return IWebElement

FindElementByCssSelector() public method

Finds the first element matching the specified CSS selector.
public FindElementByCssSelector ( string cssSelector ) : IWebElement
cssSelector string The id to match.
return IWebElement

FindElementById() public method

Finds the first element in the page that matches the ID supplied
public FindElementById ( string id ) : IWebElement
id string ID of the element
return IWebElement

FindElementByLinkText() public method

Finds the first of elements that match the link text supplied
public FindElementByLinkText ( string linkText ) : IWebElement
linkText string Link text of element
return IWebElement

FindElementByName() public method

Finds the first of elements that match the name supplied
public FindElementByName ( string name ) : IWebElement
name string Name of the element
return IWebElement

FindElementByPartialLinkText() public method

Finds the first of elements that match the part of the link text supplied
public FindElementByPartialLinkText ( string partialLinkText ) : IWebElement
partialLinkText string part of the link text
return IWebElement

FindElementByTagName() public method

Finds the first of elements that match the DOM Tag supplied
public FindElementByTagName ( string tagName ) : IWebElement
tagName string tag name of the element
return IWebElement

FindElementByXPath() public method

Finds the first of elements that match the XPath supplied
public FindElementByXPath ( string xpath ) : IWebElement
xpath string xpath to the element
return IWebElement

FindElements() public method

Finds the elements on the page by using the By object and returns a ReadOnlyCollection of the Elements on the page
public FindElements ( By by ) : ReadOnlyCollection
by By By mechanism to find the element
return ReadOnlyCollection

FindElements() protected method

Finds all child elements matching the given mechanism and value.
protected FindElements ( string mechanism, string value ) : ReadOnlyCollection
mechanism string The mechanism by which to find the elements.
value string The value to use to search for the elements.
return ReadOnlyCollection

FindElementsByClassName() public method

Finds a list of elements that match the classname supplied
public FindElementsByClassName ( string className ) : ReadOnlyCollection
className string CSS class name of the elements on the page
return ReadOnlyCollection

FindElementsByCssSelector() public method

Finds all elements matching the specified CSS selector.
public FindElementsByCssSelector ( string cssSelector ) : ReadOnlyCollection
cssSelector string The CSS selector to match.
return ReadOnlyCollection

FindElementsById() public method

Finds the first element in the page that matches the ID supplied
public FindElementsById ( string id ) : ReadOnlyCollection
id string ID of the Element
return ReadOnlyCollection

FindElementsByLinkText() public method

Finds the first of elements that match the link text supplied
public FindElementsByLinkText ( string linkText ) : ReadOnlyCollection
linkText string Link text of element
return ReadOnlyCollection

FindElementsByName() public method

Finds a list of elements that match the name supplied
public FindElementsByName ( string name ) : ReadOnlyCollection
name string Name of element
return ReadOnlyCollection

FindElementsByPartialLinkText() public method

Finds a list of elements that match the classname supplied
public FindElementsByPartialLinkText ( string partialLinkText ) : ReadOnlyCollection
partialLinkText string part of the link text
return ReadOnlyCollection

FindElementsByTagName() public method

Finds a list of elements that match the DOM Tag supplied
public FindElementsByTagName ( string tagName ) : ReadOnlyCollection
tagName string DOM Tag of the element on the page
return ReadOnlyCollection

FindElementsByXPath() public method

Finds a list of elements that match the XPath supplied
public FindElementsByXPath ( string xpath ) : ReadOnlyCollection
xpath string xpath to element on the page
return ReadOnlyCollection

GetAttribute() public method

If this current element is a form, or an element within a form, then this will be submitted to the remote server. If this causes the current page to change, then this method will block until the new page is loaded.
public GetAttribute ( string attributeName ) : string
attributeName string Attribute you wish to get details of
return string

GetCssValue() public method

Method to return the value of a CSS Property
public GetCssValue ( string propertyName ) : string
propertyName string CSS property key
return string

GetHashCode() public method

Method to get the hash code of the element
public GetHashCode ( ) : int
return int

RemoteWebElement() public method

Initializes a new instance of the RemoteWebElement class.
public RemoteWebElement ( RemoteWebDriver parentDriver, string id ) : System
parentDriver RemoteWebDriver The instance hosting this element.
id string The ID assigned to the element.
return System

Select() public method

Select or unselect element. This operation only applies to input elements such as checkboxes, options in a select and radio buttons.
public Select ( ) : void
return void

SendKeys() public method

Method for sending native key strokes to the browser
public SendKeys ( string text ) : void
text string String containing what you would like to type onto the screen
return void

Submit() public method

If this current element is a form, or an element within a form, then this will be submitted to the remote server. If this causes the current page to change, then this method will block until the new page is loaded.
public Submit ( ) : void
return void

Toggle() public method

If the element is a checkbox this will toggle the elements state from selected to not selected, or from not selected to selected
public Toggle ( ) : bool
return bool