Module: Fluent::Enclosers

Included in:
Fluent
Defined in:
lib/fluent/enclosers.rb

Instance Method Summary collapse

Instance Method Details

#will_alert(&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.

Parameters:

  • block (Proc)

    the code that generates the alert

Returns:

  • (String)

    the message contained in the alert message box



9
10
11
# File 'lib/fluent/enclosers.rb', line 9

def will_alert(&block)
  platform.will_alert(&block)
end

#will_confirm(response, &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.

Parameters:

  • response (Boolean)

    true to accept the confirmation, false to cancel it

  • block (Proc)

    the code that generates the confirmation

Returns:

  • (String)

    the message contained in the confirmation message box



20
21
22
# File 'lib/fluent/enclosers.rb', line 20

def will_confirm(response, &block)
  platform.will_confirm(response, &block)
end

#will_prompt(response, &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

Parameters:

  • response (String)

    the value to be used in the prompt

  • block (Proc)

    the code that generates the prompt

Returns:

  • (Hash)

    :message for the prompt message, :default_value for



31
32
33
# File 'lib/fluent/enclosers.rb', line 31

def will_prompt(response, &block)
  platform.will_prompt(response, &block)
end

#within_modal(&block) ⇒ Object

Used to identify a web element 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.



54
55
56
57
58
59
60
61
62
63
64
# File 'lib/fluent/enclosers.rb', line 54

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;
    }
  }
  driver.execute_script(convert_modal_to_window)
  yield if block_given?
end

#within_window(locator, &block) ⇒ Object Also known as: select_window, attach_to

Used to identify a web element or action on a web element 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

Parameters:

  • locator (Hash)

    the :title or :url of the window

  • block (Proc)

    any code that should be executed as an



43
44
45
# File 'lib/fluent/enclosers.rb', line 43

def within_window(locator, &block)
  platform.within_window(locator, &block)
end