Module: Fluent::Evaluators
- Included in:
- Fluent
- Defined in:
- lib/fluent/evaluators.rb
Instance Method Summary collapse
- #focused ⇒ Object (also: #what_has_focus?)
- #get_cookie_value(name) ⇒ Object
-
#markup ⇒ Object
(also: #html)
Page-Level Actions ##.
- #refresh ⇒ Object (also: #refresh_page)
- #remove_cookies ⇒ Object (also: #clear_cookies)
- #run_script(script, *args) ⇒ Object (also: #execute_script)
- #screenshot(file) ⇒ Object (also: #save_screenshot)
- #text ⇒ Object (also: #page_text)
- #title ⇒ Object (also: #page_title)
- #url ⇒ Object (also: #current_url)
-
#visit(url) ⇒ Object
(also: #navigate_to)
Browser-Level Actions ##.
- #wait_for_app(value = 1) ⇒ Object
-
#wait_for_pending_requests(time_limit = 30, message_if_timeout = nil) ⇒ Object
Attempts to wait for pending jQuery requests and indicate if the requests did not occur in a given time period.
-
#wait_until(timeout = Fluent.page_level_wait, message = nil, &block) ⇒ Object
(also: #wait_for)
Provides a context for an action that must succeed within a given time period.
Instance Method Details
#focused ⇒ Object Also known as: what_has_focus?
61 62 63 |
# File 'lib/fluent/evaluators.rb', line 61 def focused platform.focused end |
#get_cookie_value(name) ⇒ Object
10 11 12 |
# File 'lib/fluent/evaluators.rb', line 10 def (name) platform.(name) end |
#markup ⇒ Object Also known as: html
Page-Level Actions ##
45 46 47 |
# File 'lib/fluent/evaluators.rb', line 45 def markup platform.markup end |
#refresh ⇒ Object Also known as: refresh_page
24 25 26 |
# File 'lib/fluent/evaluators.rb', line 24 def refresh platform.refresh end |
#remove_cookies ⇒ Object Also known as:
20 21 22 |
# File 'lib/fluent/evaluators.rb', line 20 def platform. end |
#run_script(script, *args) ⇒ Object Also known as: execute_script
28 29 30 31 |
# File 'lib/fluent/evaluators.rb', line 28 def run_script(script, *args) args.map! { |obj| obj.kind_of?(Fluent::WebElements::WebElement) ? obj.web_element : obj } platform.run_script(script) end |
#screenshot(file) ⇒ Object Also known as: save_screenshot
33 34 35 |
# File 'lib/fluent/evaluators.rb', line 33 def screenshot(file) platform.screenshot file end |
#text ⇒ Object Also known as: page_text
53 54 55 |
# File 'lib/fluent/evaluators.rb', line 53 def text platform.text end |
#title ⇒ Object Also known as: page_title
49 50 51 |
# File 'lib/fluent/evaluators.rb', line 49 def title platform.title end |
#url ⇒ Object Also known as: current_url
16 17 18 |
# File 'lib/fluent/evaluators.rb', line 16 def url platform.url end |
#visit(url) ⇒ Object Also known as:
Browser-Level Actions ##
6 7 8 |
# File 'lib/fluent/evaluators.rb', line 6 def visit(url) platform.visit(url) end |
#wait_for_app(value = 1) ⇒ Object
57 58 59 |
# File 'lib/fluent/evaluators.rb', line 57 def wait_for_app(value=1) sleep value end |
#wait_for_pending_requests(time_limit = 30, message_if_timeout = nil) ⇒ Object
Attempts to wait for pending jQuery requests and indicate if the requests did not occur in a given time period.
72 73 74 75 76 77 78 79 80 |
# File 'lib/fluent/evaluators.rb', line 72 def wait_for_pending_requests(time_limit=30, =nil) end_time = ::Time.now + time_limit until ::Time.now > end_time return if driver.execute_script('return jQuery.active') == 0 wait_for_app 0.5 end = 'Pending jQuery requests never indicated completion.' unless raise end |
#wait_until(timeout = Fluent.page_level_wait, message = nil, &block) ⇒ Object Also known as: wait_for
Provides a context for an action that must succeed within a given time period. The logic here is simply that the result of the action will be true (meaning the action was carried out) or false, which means the action did not succeed in the time allotted.
90 91 92 |
# File 'lib/fluent/evaluators.rb', line 90 def wait_until(timeout=Fluent.page_level_wait, =nil, &block) platform.wait_until(timeout, , &block) end |