Module: Celerity::ClickableElement
- Included in:
- Image, InputElement, Label, Link, NonControlElement, Option, Table, TableCell, TableElement, TableRow
- Defined in:
- lib/celerity/clickable_element.rb,
lib/celerity/watir_compatibility.rb
Instance Method Summary collapse
-
#click ⇒ Object
(also: #click_no_wait)
click the element.
-
#click_and_attach ⇒ Celerity::Browser
Click the element and return a new Browser instance with the resulting page.
-
#double_click ⇒ Object
double click the element (Celerity only).
-
#download ⇒ IO
Click the element and just return the content as IO.
-
#right_click ⇒ Object
right click the element (Celerity only).
Instance Method Details
#click ⇒ Object Also known as: click_no_wait
click the element
8 9 10 11 |
# File 'lib/celerity/clickable_element.rb', line 8 def click assert_exists_and_enabled rescue_status_code_exception { @object.click } end |
#click_and_attach ⇒ Celerity::Browser
Click the element and return a new Browser instance with the resulting page. This is useful for elements that trigger popups when clicked.
38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/celerity/clickable_element.rb', line 38 def click_and_attach assert_exists_and_enabled browser = Browser.new(@browser..dup) browser.webclient.( @browser.webclient. ) # hirobumi: we do want cookies as well. @browser.disable_event_listener do rescue_status_code_exception { browser.page = @object.click } end browser end |
#double_click ⇒ Object
double click the element (Celerity only)
17 18 19 20 |
# File 'lib/celerity/clickable_element.rb', line 17 def double_click assert_exists_and_enabled rescue_status_code_exception { @object.dblClick } end |
#download ⇒ IO
Click the element and just return the content as IO. Current page stays unchanged. This can be used to download content that normally isn’t rendered in a browser.
59 60 61 62 63 64 |
# File 'lib/celerity/clickable_element.rb', line 59 def download assert_exists_and_enabled @browser.disable_event_listener do @object.click.getWebResponse.getContentAsStream.to_io end end |
#right_click ⇒ Object
right click the element (Celerity only)
26 27 28 29 |
# File 'lib/celerity/clickable_element.rb', line 26 def right_click assert_exists_and_enabled rescue_status_code_exception { @object.rightClick } end |