Class: Selenium::HtmlElement
- Inherits:
-
Object
- Object
- Selenium::HtmlElement
- Defined in:
- lib/selenium/html_element.rb
Instance Attribute Summary collapse
-
#locator ⇒ Object
readonly
Returns the value of attribute locator.
-
#webpage ⇒ Object
readonly
Returns the value of attribute webpage.
Instance Method Summary collapse
- #browser ⇒ Object
-
#click ⇒ Object
click the element.
-
#click_wait ⇒ Object
click the element and wait for page to load TODO: wait on block instead if givven.
- #double_click ⇒ Object
-
#initialize(webpage, locator) ⇒ HtmlElement
constructor
A new instance of HtmlElement.
- #key_press(key) ⇒ Object
- #present? ⇒ Boolean
- #text ⇒ Object
Constructor Details
#initialize(webpage, locator) ⇒ HtmlElement
Returns a new instance of HtmlElement.
4 5 6 7 8 |
# File 'lib/selenium/html_element.rb', line 4 def initialize(webpage, locator) webpage = WebPage.new(webpage) if webpage.is_a? SeleniumDriver @webpage = webpage @locator = locator end |
Instance Attribute Details
#locator ⇒ Object (readonly)
Returns the value of attribute locator.
3 4 5 |
# File 'lib/selenium/html_element.rb', line 3 def locator @locator end |
#webpage ⇒ Object (readonly)
Returns the value of attribute webpage.
3 4 5 |
# File 'lib/selenium/html_element.rb', line 3 def webpage @webpage end |
Instance Method Details
#browser ⇒ Object
10 11 12 |
# File 'lib/selenium/html_element.rb', line 10 def browser webpage.browser end |
#click ⇒ Object
click the element
23 24 25 |
# File 'lib/selenium/html_element.rb', line 23 def click @webpage.click(@locator) end |
#click_wait ⇒ Object
click the element and wait for page to load TODO: wait on block instead if givven
29 30 31 |
# File 'lib/selenium/html_element.rb', line 29 def click_wait @webpage.click_wait(@locator) end |
#double_click ⇒ Object
33 34 35 |
# File 'lib/selenium/html_element.rb', line 33 def double_click @webpage.double_click(@locator) end |
#key_press(key) ⇒ Object
37 38 39 |
# File 'lib/selenium/html_element.rb', line 37 def key_press(key) @webpage.key_press(@locator, key) end |
#present? ⇒ Boolean
18 19 20 |
# File 'lib/selenium/html_element.rb', line 18 def present? @webpage.element_present? @locator end |
#text ⇒ Object
14 15 16 |
# File 'lib/selenium/html_element.rb', line 14 def text @webpage.text(@locator) end |