Module: Celerity::ClickableElement
- Defined in:
- lib/celerity/clickable_element.rb,
lib/celerity/watir_compatibility.rb
Method Summary
- - (Object) click (also: #click_no_wait) click the element.
- - (Celerity::Browser) click_and_attach Click the element and return a new Browser instance with the resulting page.
- - (Object) double_click double click the element (Celerity only).
- - (IO) download Click the element and just return the content as IO.
- - (Object) right_click right click the element (Celerity only).
Method Details
- (Object) click 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 |
- (Celerity::Browser) click_and_attach
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 |
- (Object) double_click
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 |
- (IO) download
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 |
- (Object) right_click
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 |