Class: Selenium::Link
- Inherits:
-
Object
- Object
- Selenium::Link
- Defined in:
- lib/selenium/link.rb
Overview
Link class that models the behavior of a link
Instance Attribute Summary collapse
-
#browser ⇒ Object
readonly
Returns the value of attribute browser.
Class Method Summary collapse
Instance Method Summary collapse
-
#click ⇒ Object
click the link.
-
#click_wait ⇒ Object
click the link and wait for page to load.
-
#go ⇒ Object
click the link, wait for the page to load, and asserts the target that was passed in during initialization.
-
#initialize(browser, locator, target = nil) ⇒ Link
constructor
A new instance of Link.
Constructor Details
#initialize(browser, locator, target = nil) ⇒ Link
Returns a new instance of Link.
15 16 17 18 19 |
# File 'lib/selenium/link.rb', line 15 def initialize(browser, locator, target = nil) @browser = browser @locator = locator @target = target end |
Instance Attribute Details
#browser ⇒ Object (readonly)
Returns the value of attribute browser.
5 6 7 |
# File 'lib/selenium/link.rb', line 5 def browser @browser end |
Class Method Details
Instance Method Details
#click ⇒ Object
click the link
22 23 24 |
# File 'lib/selenium/link.rb', line 22 def click @browser.click(@locator) end |
#click_wait ⇒ Object
click the link and wait for page to load
27 28 29 30 |
# File 'lib/selenium/link.rb', line 27 def click_wait click @browser.wait_for_page_to_load end |
#go ⇒ Object
click the link, wait for the page to load, and asserts the target that was passed in during initialization
34 35 36 37 38 39 |
# File 'lib/selenium/link.rb', line 34 def go raise "target page not defined for link #{@locator}" unless @target click_wait @target.assert_on_page @target end |