Module SeleniumOnRails::TestBuilderAccessors
In: lib/selenium_on_rails/test_builder_accessors.rb

The accessors available for SeleniumOnRails::TestBuilder tests.

For each store_foo there’s assert_foo, assert_not_foo, verify_foo, verify_not_foo, wait_for_foo, wait_for_not_foo.

Methods

Public Instance methods

Gets the absolute URL of the current page.

Related Assertions, automatically generated:

  • assert_absolute_location(pattern)
  • assert_not_absolute_location(pattern)
  • verify_absolute_location_present(pattern)
  • verify_not_absolute_location(pattern)
  • wait_for_absolute_location(pattern)
  • wait_for_not_absolute_location(pattern)

[Source]

     # File lib/selenium_on_rails/test_builder_accessors.rb, line 129
129:   def store_absolute_location variable_name
130:     command 'storeAbsoluteLocation', variable_name
131:   end

Retrieves the message of a JavaScript alert generated during the previous action, or fail if there were no alerts.

Getting an alert has the same effect as manually clicking OK. If an alert is generated but you do not get/verify it, the next Selenium action will fail.

NOTE: under Selenium, JavaScript alerts will NOT pop up a visible alert dialog.

NOTE: Selenium does NOT support JavaScript alerts that are generated in a page’s onload() event handler. In this case a visible dialog WILL be generated and Selenium will hang until someone manually clicks OK.

Related Assertions, automatically generated:

  • assert_alert(pattern)
  • assert_not_alert(pattern)
  • verify_alert_present(pattern)
  • verify_not_alert(pattern)
  • wait_for_alert(pattern)
  • wait_for_not_alert(pattern)

[Source]

    # File lib/selenium_on_rails/test_builder_accessors.rb, line 66
66:   def store_alert variable_name
67:     command 'storeAlert', variable_name
68:   end

Has an alert occurred?

Related Assertions, automatically generated:

  • assert_alert_present
  • assert_alert_not_present
  • verify_alert_present
  • verify_alert_not_present
  • wait_for_alert_present
  • wait_for_alert_not_present

[Source]

    # File lib/selenium_on_rails/test_builder_accessors.rb, line 15
15:   def store_alert_present variable_name
16:     command 'storeAlertPresent', variable_name
17:   end

Returns the IDs of all buttons on the page.

If a given button has no ID, it will appear as "" in this array.

The pattern for the automatically generated assertions can either take an array or a pattern.

 assert_all_buttons ['but1', 'but2']
 assert_all_buttons 'but?,but?*'

Related Assertions, automatically generated:

  • assert_all_buttons(pattern)
  • assert_not_all_buttons(pattern)
  • verify_all_buttons(pattern)
  • verify_not_all_buttons(pattern)
  • wait_for_all_buttons(pattern)
  • wait_for_not_all_buttons(pattern)

[Source]

     # File lib/selenium_on_rails/test_builder_accessors.rb, line 400
400:   def store_all_buttons variable_name
401:     command 'storeAllButtons', variable_name
402:   end

Returns the IDs of all input fields on the page.

If a given field has no ID, it will appear as "" in this array.

The pattern for the automatically generated assertions can either take an array or a pattern.

 assert_all_fields ['field1', 'field2']
 assert_all_fields 'field?,field?*'

Related Assertions, automatically generated:

  • assert_all_fields(pattern)
  • assert_not_all_fields(pattern)
  • verify_all_fields(pattern)
  • verify_not_all_fields(pattern)
  • wait_for_all_fields(pattern)
  • wait_for_not_all_fields(pattern)

[Source]

     # File lib/selenium_on_rails/test_builder_accessors.rb, line 440
440:   def store_all_fields variable_name
441:     command 'storeAllFields', variable_name
442:   end

Returns the IDs of all links on the page.

If a given link has no ID, it will appear as "" in this array.

The pattern for the automatically generated assertions can either take an array or a pattern.

 assert_all_links ['link1', 'link2']
 assert_all_links 'link?,link?*'

Related Assertions, automatically generated:

  • assert_all_links(pattern)
  • assert_not_all_links(pattern)
  • verify_all_links(pattern)
  • verify_not_all_links(pattern)
  • wait_for_all_links(pattern)
  • wait_for_not_all_links(pattern)

[Source]

     # File lib/selenium_on_rails/test_builder_accessors.rb, line 420
420:   def store_all_links variable_name
421:     command 'storeAllLinks', variable_name
422:   end

Gets the value of an element attribute.

Related Assertions, automatically generated:

  • assert_attribute(locator, attribute_name, pattern)
  • assert_not_attribute(locator, attribute_name, pattern)
  • verify_attribute_present(locator, attribute_name, pattern)
  • verify_not_attribute(locator, attribute_name, pattern)
  • wait_for_attribute(locator, attribute_name, pattern)
  • wait_for_not_attribute(locator, attribute_name, pattern)

[Source]

     # File lib/selenium_on_rails/test_builder_accessors.rb, line 322
322:   def store_attribute locator, attribute_name, variable_name
323:     command 'storeAttribute', "#{locator}@#{attribute_name}", variable_name
324:   end

Gets the entire text of the page.

Related Assertions, automatically generated:

  • assert_body_text(pattern)
  • assert_not_body_text(pattern)
  • verify_body_text_present(pattern)
  • verify_not_body_text(pattern)
  • wait_for_body_text(pattern)
  • wait_for_not_body_text(pattern)

[Source]

     # File lib/selenium_on_rails/test_builder_accessors.rb, line 169
169:   def store_body_text variable_name
170:     command 'storeBodyText', variable_name
171:   end

Gets whether a toggle-button (checkbox/radio) is checked. Fails if the specified element doesn’t exist or isn’t a toggle-button.

Related Assertions, automatically generated:

  • assert_checked(locator, pattern)
  • assert_not_checked(locator, pattern)
  • verify_checked_present(locator, pattern)
  • verify_not_checked(locator, pattern)
  • wait_for_checked(locator, pattern)
  • wait_for_not_checked(locator, pattern)

[Source]

     # File lib/selenium_on_rails/test_builder_accessors.rb, line 239
239:   def store_checked locator, variable_name
240:     command 'storeChecked', locator, variable_name
241:   end

Retrieves the message of a JavaScript confirmation dialog generated during the previous action.

By default, the confirm function will return true, having the same effect as manually clicking OK. This can be changed by prior execution of the choose_cancel_on_next_confirmation command. If a confirmation is generated but you do not get/verify it, the next Selenium action will fail.

NOTE: under Selenium, JavaScript confirmations will NOT pop up a visible dialog.

NOTE: Selenium does NOT support JavaScript confirmations that are generated in a page’s onload() event handler. In this case a visible dialog WILL be generated and Selenium will hang until you manually click OK.

Related Assertions, automatically generated:

  • assert_confirmation(pattern)
  • assert_not_confirmation(pattern)
  • verify_confirmation_present(pattern)
  • verify_not_confirmation(pattern)
  • wait_for_confirmation(pattern)
  • wait_for_not_confirmation(pattern)

[Source]

    # File lib/selenium_on_rails/test_builder_accessors.rb, line 92
92:   def store_confirmation variable_name
93:     command 'storeConfirmation', variable_name
94:   end

Has confirm() been called?

Related Assertions, automatically generated:

  • assert_confirmation_present
  • assert_confirmation_not_present
  • verify_confirmation_present
  • verify_confirmation_not_present
  • wait_for_confirmation_present
  • wait_for_confirmation_not_present

[Source]

    # File lib/selenium_on_rails/test_builder_accessors.rb, line 41
41:   def store_confirmation_present variable_name
42:     command 'storeConfirmationPresent', variable_name
43:   end

Determines whether the specified input element is editable, i.e. hasn’t been disabled. This method will fail if the specified element isn’t an input element.

Related Assertions, automatically generated:

  • assert_editable(locator)
  • assert_not_editable(locator)
  • verify_editable(locator)
  • verify_not_editable(locator)
  • wait_for_editable(locator)
  • wait_for_not_editable(locator)

[Source]

     # File lib/selenium_on_rails/test_builder_accessors.rb, line 380
380:   def store_editable locator, variable_name
381:     command 'storeEditable', locator, variable_name
382:   end

Verifies that the specified element is somewhere on the page.

Related Assertions, automatically generated:

  • assert_element_present(locator)
  • assert_element_not_present(locator)
  • verify_element_present(locator)
  • verify_element_not_present(locator)
  • wait_for_element_present(locator)
  • wait_for_element_not_present(locator)

[Source]

     # File lib/selenium_on_rails/test_builder_accessors.rb, line 349
349:   def store_element_present locator, variable_name
350:     command 'storeElementPresent', locator, variable_name
351:   end

Gets the result of evaluating the specified JavaScript snippet. The snippet may have multiple lines, but only the result of the last line will be returned.

Note that, by default, the snippet will run in the context of the "selenium" object itself, so this will refer to the Selenium object, and window will refer to the top-level runner test window, not the window of your application.

If you need a reference to the window of your application, you can refer to this.browserbot.getCurrentWindow() and if you need to use a locator to refer to a single element in your application page, you can use this.page().findElement("foo") where "foo" is your locator.

Related Assertions, automatically generated:

  • assert_eval(script, pattern)
  • assert_not_eval(script, pattern)
  • verify_eval_present(script, pattern)
  • verify_not_eval(script, pattern)
  • wait_for_eval(script, pattern)
  • wait_for_not_eval(script, pattern)

[Source]

     # File lib/selenium_on_rails/test_builder_accessors.rb, line 225
225:   def store_eval script, variable_name
226:     command 'storeEval', script, variable_name
227:   end

Returns the specified expression.

This is useful because of JavaScript preprocessing.

Related Assertions, automatically generated:

  • assert_expression(expression, pattern)
  • assert_not_expression(expression, pattern)
  • verify_expression(expression, pattern)
  • verify_not_expression(expression, pattern)
  • wait_for_expression(expression, pattern)
  • wait_for_not_expression(expression, pattern)

[Source]

     # File lib/selenium_on_rails/test_builder_accessors.rb, line 468
468:   def store_expression expression, variable_name
469:     command 'storeExpression', expression, variable_name
470:   end

Returns the entire HTML source between the opening and closing "html" tags.

Related Assertions, automatically generated:

  • assert_html_source(pattern)
  • assert_not_html_source(pattern)
  • verify_html_source(pattern)
  • verify_not_html_source(pattern)
  • wait_for_html_source(pattern)
  • wait_for_not_html_source(pattern)

[Source]

     # File lib/selenium_on_rails/test_builder_accessors.rb, line 453
453:   def store_html_source variable_name
454:     command 'storeHtmlSource', variable_name
455:   end

Verify the location of the current page ends with the expected location. If an URL querystring is provided, this is checked as well.

Related Assertions, automatically generated:

  • assert_location(pattern)
  • assert_not_location(pattern)
  • verify_location_present(pattern)
  • verify_not_location(pattern)
  • wait_for_location(pattern)
  • wait_for_not_location(pattern)

[Source]

     # File lib/selenium_on_rails/test_builder_accessors.rb, line 143
143:   def store_location expected_location, variable_name
144:     command 'storeLocation', expected_location, variable_name
145:   end

Retrieves the message of a JavaScript question prompt dialog generated during the previous action.

Successful handling of the prompt requires prior execution of the answer_on_next_prompt command. If a prompt is generated but you do not get/verify it, the next Selenium action will fail.

NOTE: under Selenium, JavaScript prompts will NOT pop up a visible dialog.

NOTE: Selenium does NOT support JavaScript prompts that are generated in a page’s onload() event handler. In this case a visible dialog WILL be generated and Selenium will hang until someone manually clicks OK.

Related Assertions, automatically generated:

  • assert_prompt(pattern)
  • assert_not_prompt(pattern)
  • verify_prompt_present(pattern)
  • verify_not_prompt(pattern)
  • wait_for_prompt(pattern)
  • wait_for_not_prompt(pattern)

[Source]

     # File lib/selenium_on_rails/test_builder_accessors.rb, line 116
116:   def store_prompt variable_name
117:     command 'storePrompt', variable_name
118:   end

Has a prompt occurred?

Related Assertions, automatically generated:

  • assert_prompt_present
  • assert_prompt_not_present
  • verify_prompt_present
  • verify_prompt_not_present
  • wait_for_prompt_present
  • wait_for_prompt_not_present

[Source]

    # File lib/selenium_on_rails/test_builder_accessors.rb, line 28
28:   def store_prompt_present variable_name
29:     command 'storePromptPresent', variable_name
30:   end

Gets all option labels in the specified select drop-down.

The pattern for the automatically generated assertions can either take an array or a pattern.

 assert_select_options 'fruits', ['apple', 'pear']
 assert_select_options 'fruits', 'a*,p*'

Related Assertions, automatically generated:

  • assert_select_options(locator, pattern)
  • assert_not_select_options(locator, pattern)
  • verify_select_options_present(locator, pattern)
  • verify_not_select_options(locator, pattern)
  • wait_for_select_options(locator, pattern)
  • wait_for_not_select_options(locator, pattern)

[Source]

     # File lib/selenium_on_rails/test_builder_accessors.rb, line 309
309:   def store_select_options locator, variable_name
310:     command 'storeSelectOptions', locator, variable_name
311:   end

Verifies that the selected option of a drop-down satisfies the option_locator.

option_locator is typically just an option label (e.g. "John Smith").

See the select command for more information about option locators.

NOTE: store_selected is currently not supported by Selenium Core.

Related Assertions, automatically generated:

  • assert_selected(locator, option_locator)
  • assert_not_selected(locator, option_locator)
  • verify_selected_present(locator, option_locator)
  • verify_not_selected(locator, option_locator)
  • wait_for_selected(locator, option_locator)
  • wait_for_not_selected(locator, option_locator)

[Source]

     # File lib/selenium_on_rails/test_builder_accessors.rb, line 272
272:   def store_selected locator, option_locator, variable_name
273:     raise 'Not supported in Selenium Core at the moment'
274:   end

Gets all option labels for selected options in the specified select or multi-select element.

The pattern for the automatically generated assertions can either take an array or a pattern.

 assert_selected_options 'fruits', ['apple', 'pear']
 assert_selected_options 'fruits', 'a*,p*'

Related Assertions, automatically generated:

  • assert_selected_options(locator, pattern)
  • assert_not_selected_options(locator, pattern)
  • verify_selected_options_present(locator, pattern)
  • verify_not_selected_options(locator, pattern)
  • wait_for_selected_options(locator, pattern)
  • wait_for_not_selected_options(locator, pattern)

[Source]

     # File lib/selenium_on_rails/test_builder_accessors.rb, line 291
291:   def store_selected_options locator, variable_name
292:     command 'storeSelectedOptions', locator, variable_name
293:   end

Gets the text from a cell of a table.

Related Assertions, automatically generated:

  • assert_table(locator, row, column, pattern)
  • assert_not_table(locator, row, column, pattern)
  • verify_table_present(locator, row, column, pattern)
  • verify_not_table(locator, row, column, pattern)
  • wait_for_table(locator, row, column, pattern)
  • wait_for_not_table(locator, row, column, pattern)

[Source]

     # File lib/selenium_on_rails/test_builder_accessors.rb, line 252
252:   def store_table locator, row, column, variable_name
253:     command 'storeTable', "#{locator}.#{row}.#{column}", variable_name
254:   end

Gets the text of an element. This works for any element that contains text. This command uses either the textContent (Mozilla-like browsers) or the innerText (IE-like browsers) of the element, which is the rendered text shown to the user.

Related Assertions, automatically generated:

  • assert_text(locator, pattern)
  • assert_not_text(locator, pattern)
  • verify_text_present(locator, pattern)
  • verify_not_text(locator, pattern)
  • wait_for_text(locator, pattern)
  • wait_for_not_text(locator, pattern)

[Source]

     # File lib/selenium_on_rails/test_builder_accessors.rb, line 200
200:   def store_text locator, variable_name
201:     command 'storeText', locator, variable_name
202:   end

Verifies that the specified text pattern appears somewhere on the rendered page shown to the user.

Related Assertions, automatically generated:

  • assert_text_present(pattern)
  • assert_text_not_present(pattern)
  • verify_text_present(pattern)
  • verify_text_not_present(pattern)
  • wait_for_text_present(pattern)
  • wait_for_text_not_present(pattern)

[Source]

     # File lib/selenium_on_rails/test_builder_accessors.rb, line 336
336:   def store_text_present pattern, variable_name
337:     command 'storeTextPresent', pattern, variable_name
338:   end

Gets the title of the current page.

Related Assertions, automatically generated:

  • assert_title(pattern)
  • assert_not_title(pattern)
  • verify_title_present(pattern)
  • verify_not_title(pattern)
  • wait_for_title(pattern)
  • wait_for_not_title(pattern)

[Source]

     # File lib/selenium_on_rails/test_builder_accessors.rb, line 156
156:   def store_title variable_name
157:     command 'storeTitle', variable_name
158:   end

Gets the (whitespace-trimmed) value of an input field (or anything else with a value parameter). For checkbox/radio elements, the value will be "on" or "off" depending on whether the element is checked or not.

Related Assertions, automatically generated:

  • assert_value(locator, pattern)
  • assert_not_value(locator, pattern)
  • verify_value_present(locator, pattern)
  • verify_not_value(locator, pattern)
  • wait_for_value(locator, pattern)
  • wait_for_not_value(locator, pattern)

[Source]

     # File lib/selenium_on_rails/test_builder_accessors.rb, line 184
184:   def store_value locator, variable_name
185:     command 'storeValue', locator, variable_name
186:   end

Determines if the specified element is visible. An element can be rendered invisible by setting the CSS "visibility" property to "hidden", or the "display" property to "none", either for the element itself or one if its ancestors. This method will fail if the element is not present.

Related Assertions, automatically generated:

  • assert_visible(locator)
  • assert_not_visible(locator)
  • verify_visible(locator)
  • verify_not_visible(locator)
  • wait_for_visible(locator)
  • wait_for_not_visible(locator)

[Source]

     # File lib/selenium_on_rails/test_builder_accessors.rb, line 365
365:   def store_visible locator, variable_name
366:     command 'storeVisible', locator, variable_name
367:   end

[Validate]