Module: Symbiont::Enclosers
- Included in:
- Symbiont
- Defined in:
- lib/symbiont/enclosers.rb
Instance Method Summary collapse
-
#wait_for(timeout = Symbiont.page_level_wait, message = nil, &block) ⇒ Object
Provides a context for an action that must succeed within a given time period.
-
#will_alert(encloser = nil, &block) ⇒ String
Provides a context for an action that will generate a JavaScript alert message box.
-
#will_confirm(response, encloser = nil, &block) ⇒ String
Provides a context for an action that will generate a JavaScript confirmation message box.
-
#will_prompt(response, encloser = nil, &block) ⇒ Hash
Provides a context for an action that will generate a JavaScript prompt message box.
-
#within_frame(locator, encloser = nil, &block) ⇒ Object
Used to identify a web object as existing within an enclosing object like a frame or an iframe.
-
#within_modal(&block) ⇒ Object
Used to identify a web object as existing within an enclosing object like a modal dialog box.
-
#within_window(locator, &block) ⇒ Object
Used to identify a web object or action on a web object as existing within an enclosing window object.
Instance Method Details
#wait_for(timeout = Symbiont.page_level_wait, message = nil, &block) ⇒ Object
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.
16 17 18 |
# File 'lib/symbiont/enclosers.rb', line 16 def wait_for(timeout=Symbiont.page_level_wait, =nil, &block) platform.wait_for(timeout, , &block) end |
#will_alert(encloser = nil, &block) ⇒ String
Provides a context for an action that will generate a JavaScript alert message box. The alert invocation will be overridden by the platform.
81 82 83 |
# File 'lib/symbiont/enclosers.rb', line 81 def will_alert(encloser=nil, &block) platform.will_alert(encloser, &block) end |
#will_confirm(response, encloser = nil, &block) ⇒ String
Provides a context for an action that will generate a JavaScript confirmation message box. The confirmation invocation will be overridden by the platform.
97 98 99 |
# File 'lib/symbiont/enclosers.rb', line 97 def will_confirm(response, encloser=nil, &block) platform.will_confirm(response, encloser, &block) end |
#will_prompt(response, encloser = nil, &block) ⇒ Hash
Provides a context for an action that will generate a JavaScript prompt message box. The prompt invocation will be overridden by the platform.
the value that the prompt had before the response was applied
113 114 115 |
# File 'lib/symbiont/enclosers.rb', line 113 def will_prompt(response, encloser=nil, &block) platform.will_prompt(response, encloser, &block) end |
#within_frame(locator, encloser = nil, &block) ⇒ Object
Used to identify a web object as existing within an enclosing object like a frame or an iframe. It is possible to nest by passing in parent enclosers as the second parameter.
only valid locators here are :id, :index, and :name encloser
51 52 53 |
# File 'lib/symbiont/enclosers.rb', line 51 def within_frame(locator, encloser=nil, &block) platform.within_frame(locator, encloser, &block) end |
#within_modal(&block) ⇒ Object
Used to identify a web object as existing within an enclosing object like a modal dialog box. What this does is override the normal call to showModalDialog and opens a window instead. In order to use this new window, you have to attach to it.
59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/symbiont/enclosers.rb', line 59 def within_modal(&block) convert_modal_to_window = %Q{ window.showModalDialog = function(sURL, vArguments, sFeatures) { window.dialogArguments = vArguments; modalWin = window.open(sURL, 'modal', sFeatures); return modalWin; } } @browser.execute_script(convert_modal_to_window) yield if block_given? end |
#within_window(locator, &block) ⇒ Object
Used to identify a web object or action on a web object as existing within an enclosing window object. The window can be referenced using either the title attribute of the window or a direct URL. The URL does not have to be the entire URL; it can just be a page name.
action on or within the window
32 33 34 |
# File 'lib/symbiont/enclosers.rb', line 32 def within_window(locator, &block) platform.within_window(locator, &block) end |