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.
Gets the absolute URL of the current page.
Related Assertions, automatically generated:
# 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:
# 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:
# 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:
# 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:
# 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:
# 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:
# 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:
# 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:
# 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:
# 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:
# 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:
# 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:
# 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:
# 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:
# 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:
# 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:
# 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:
# 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:
# 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:
# 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:
# 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:
# 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:
# 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:
# 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:
# 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:
# 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:
# 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:
# 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