Class Selenium::WebDriver::Element
In: lib/selenium/webdriver/common/element.rb
Parent: Object

Methods

==   []   as_json   attribute   clear   click   displayed?   drag_and_drop_by   drag_and_drop_on   enabled?   eql?   hash   inspect   location   location_once_scrolled_into_view   new   ref   select   selected?   send_key   send_keys   size   style   submit   tag_name   text   to_json   toggle   value  

Included Modules

SearchContext

External Aliases

find_element -> first
  element.first(:id, ‘foo’)
find_elements -> all
  element.all(:class, ‘bar’)

Attributes

bridge  [R] 

Public Class methods

Creates a new Element

@api private

Public Instance methods

[](name)

Alias for attribute

Get the value of a the given attribute of the element. Will return the current value, even if this has been modified after the page has been loaded. More exactly, this method will return the value of the given attribute, unless that attribute is not present, in which case the value of the property with the same name is returned. If neither value is set, nil is returned. The "style" attribute is converted as best can be to a text representation with a trailing semi-colon. The following are deemed to be "boolean" attributes, and will return either "true" or "false":

async, autofocus, autoplay, checked, compact, complete, controls, declare, defaultchecked, defaultselected, defer, disabled, draggable, ended, formnovalidate, hidden, indeterminate, iscontenteditable, ismap, itemscope, loop, multiple, muted, nohref, noresize, noshade, novalidate, nowrap, open, paused, pubdate, readonly, required, reversed, scoped, seamless, seeking, selected, spellcheck, truespeed, willvalidate

Finally, the following commonly mis-capitalized attribute/property names are evaluated as expected:

class, readonly

@param [String]

  attribute name

@return [String,nil]

  attribute value

Clear this element

Click the element

Is the element displayed?

@return [Boolean]

Drag and drop this element

@param [Integer] right_by

  number of pixels to drag right

@param [Integer] down_by

  number of pixels to drag down

Drag and drop this element on the given element

@param [WebDriver::Element] other

Is the element enabled?

@return [Boolean]

eql?(other)

Alias for #==

Get the location of this element.

@return [WebDriver::Point]

Determine an element‘s location on the screen once it has been scrolled into view.

@return [WebDriver::Point]

for SearchContext and execute_script

@api private

Select this element

Is the element selected?

@return [Boolean]

send_key(*args)

Alias for send_keys

Send keystrokes to this element

@param [String, Symbol, Array]

Examples:

    element.send_keys "foo"                     #=> value: 'foo'
    element.send_keys "tet", :arrow_left, "s"   #=> value: 'test'
    element.send_keys [:control, 'a'], :space   #=> value: ' '

@see Keys::KEYS

Get the size of this element

@return [WebDriver::Dimension]

Get the value of the given CSS property

Submit this element

Get the tag name of this element

@return [String]

Get the text content of this element

@return [String]

Convert to a WebElement JSON Object for transmission over the wire. @see code.google.com/p/selenium/wiki/JsonWireProtocol#Basic_Concepts_And_Terms

@api private

Toggle this element

Get the value of this element

@return [String]

[Validate]