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 246 246: def store_absolute_location variable_name 247: command 'storeAbsoluteLocation', variable_name 248: 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 183 183: def store_alert variable_name 184: command 'storeAlert', variable_name 185: end
Has an alert occurred?
Related Assertions, automatically generated:
# File lib/selenium_on_rails/test_builder_accessors.rb, line 89 89: def store_alert_present variable_name 90: command 'storeAlertPresent', variable_name 91: 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 754 754: def store_all_buttons variable_name 755: command 'storeAllButtons', variable_name 756: 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 794 794: def store_all_fields variable_name 795: command 'storeAllFields', variable_name 796: 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 774 774: def store_all_links variable_name 775: command 'storeAllLinks', variable_name 776: end
Returns the IDs of all windows that the browser knows about.
Related Assertions, automatically generated:
# File lib/selenium_on_rails/test_builder_accessors.rb, line 50 50: def store_all_window_ids variable_name 51: command 'storeAllWindowIds', variable_name 52: end
Returns the names of all windows that the browser knows about.
Related Assertions, automatically generated:
# File lib/selenium_on_rails/test_builder_accessors.rb, line 63 63: def store_all_window_names variable_name 64: command 'storeAllWindowNames', variable_name 65: end
Returns the titles of all windows that the browser knows about.
Related Assertions, automatically generated:
# File lib/selenium_on_rails/test_builder_accessors.rb, line 76 76: def store_all_window_titles variable_name 77: command 'storeAllWindowTitles', variable_name 78: end
Gets the value of an element attribute.
Related Assertions, automatically generated:
# File lib/selenium_on_rails/test_builder_accessors.rb, line 577 577: def store_attribute locator, attribute_name, variable_name 578: command 'storeAttribute', "#{locator}@#{attribute_name}", variable_name 579: end
Returns every instance of some attribute from all known windows.
Related Assertions, automatically generated:
# File lib/selenium_on_rails/test_builder_accessors.rb, line 102 102: def store_attribute_from_all_windows attribute_name, variable_name 103: command 'storeAttributeFromAllWindows', attribute_name, variable_name 104: end
Gets the entire text of the page.
Related Assertions, automatically generated:
# File lib/selenium_on_rails/test_builder_accessors.rb, line 300 300: def store_body_text variable_name 301: command 'storeBodyText', variable_name 302: 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 370 370: def store_checked locator, variable_name 371: command 'storeChecked', locator, variable_name 372: 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 209 209: def store_confirmation variable_name 210: command 'storeConfirmation', variable_name 211: end
Has confirm() been called?
Related Assertions, automatically generated:
# File lib/selenium_on_rails/test_builder_accessors.rb, line 128 128: def store_confirmation_present variable_name 129: command 'storeConfirmationPresent', variable_name 130: end
Return all cookies of the current page under test.
Related Assertions, automatically generated:
# File lib/selenium_on_rails/test_builder_accessors.rb, line 141 141: def store_cookie variable_name 142: command 'storeCookie', variable_name 143: end
Retrieves the text cursor position in the given input element or textarea; beware, this may not work perfectly on all browsers.
This method will fail if the specified element isn‘t an input element or textarea, or there is no cursor in the element.
Related Assertions, automatically generated:
# File lib/selenium_on_rails/test_builder_accessors.rb, line 158 158: def store_cursor_position locator, variable_name 159: command 'storeCursorPosition', locator, variable_name 160: 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 734 734: def store_editable locator, variable_name 735: command 'storeEditable', locator, variable_name 736: end
Retrieves the height of an element. This method will fail if the element is not present.
Related Assertions, automatically generated:
# File lib/selenium_on_rails/test_builder_accessors.rb, line 650 650: def store_element_height locator, variable_name 651: command 'storeElementHeight', locator, variable_name 652: end
Get the relative index of an element to its parent (starting from 0). The comment node and empty text node will be ignored.
Related Assertions, automatically generated:
# File lib/selenium_on_rails/test_builder_accessors.rb, line 664 664: def store_element_index locator, variable_name 665: command 'storeElementIndex', locator, variable_name 666: end
Retrieves the horizontal position of an element. This method will fail if the element is not present.
Related Assertions, automatically generated:
# File lib/selenium_on_rails/test_builder_accessors.rb, line 692 692: def store_element_position_left locator, variable_name 693: command 'storeElementPositionLeft', locator, variable_name 694: end
Retrieves the vertical position of an element. This method will fail if the element is not present.
Related Assertions, automatically generated:
# File lib/selenium_on_rails/test_builder_accessors.rb, line 706 706: def store_element_position_top locator, variable_name 707: command 'storeElementPositionTop', locator, variable_name 708: 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 620 620: def store_element_present locator, variable_name 621: command 'storeElementPresent', locator, variable_name 622: end
Retrieves the width of an element. This method will fail if the element is not present.
Related Assertions, automatically generated:
# File lib/selenium_on_rails/test_builder_accessors.rb, line 678 678: def store_element_width locator, variable_name 679: command 'storeElementWidth', locator, variable_name 680: end
Tell Selenium to expect an error on the next command execution.
NOTE: store_error_on_next is currently not supported by Selenium Core and is only added to here as a shortcut for generating the related assertions.
Related Assertions, automatically generated:
# File lib/selenium_on_rails/test_builder_accessors.rb, line 20 20: def store_error_on_next message 21: raise 'Not supported in Selenium Core at the moment' 22: 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 356 356: def store_eval script, variable_name 357: command 'storeEval', script, variable_name 358: 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 822 822: def store_expression expression, variable_name 823: command 'storeExpression', expression, variable_name 824: end
Tell Selenium to expect a failure on the next command execution.
NOTE: store_failure_on_next is currently not supported by Selenium Core and is only added to here as a shortcut for generating the related assertions.
Related Assertions, automatically generated:
# File lib/selenium_on_rails/test_builder_accessors.rb, line 37 37: def store_failure_on_next message 38: raise 'Not supported in Selenium Core at the moment' 39: 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 807 807: def store_html_source variable_name 808: command 'storeHtmlSource', variable_name 809: 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 260 260: def store_location expected_location, variable_name 261: command 'storeLocation', expected_location, variable_name 262: end
Return the contents of the log.
Related Assertions, automatically generated:
# File lib/selenium_on_rails/test_builder_accessors.rb, line 719 719: def store_log_messages variable_name 720: command 'storeLogMessages', variable_name 721: end
Returns the number of pixels between "mousemove" events during drag_and_drop commands (default=10).
Related Assertions, automatically generated:
# File lib/selenium_on_rails/test_builder_accessors.rb, line 274 274: def store_mouse_speed variable_name 275: command 'storeMouseSpeed', variable_name 276: end
Check if these two elements have same parent and are ordered. Two same elements will not be considered ordered.
NOTE: store_ordered is currently not supported by Selenium Core.
Related Assertions, automatically generated:
# File lib/selenium_on_rails/test_builder_accessors.rb, line 593 593: def store_ordered locator_1, locator_2, variable_name 594: raise 'Not supported in Selenium Core at the moment' 595: 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 233 233: def store_prompt variable_name 234: command 'storePrompt', variable_name 235: end
Has a prompt occurred?
Related Assertions, automatically generated:
# File lib/selenium_on_rails/test_builder_accessors.rb, line 115 115: def store_prompt_present variable_name 116: command 'storePromptPresent', variable_name 117: 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 564 564: def store_select_options locator, variable_name 565: command 'storeSelectOptions', locator, variable_name 566: 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 403 403: def store_selected locator, option_locator, variable_name 404: raise 'Not supported in Selenium Core at the moment' 405: end
Gets option element ID for selected option in the specified select element.
Related Assertions, automatically generated:
# File lib/selenium_on_rails/test_builder_accessors.rb, line 416 416: def store_selected_id select_locator, variable_name 417: command 'storeSelectedId', select_locator, variable_name 418: end
Gets all option element IDs for selected options in the specified select or multi-select element.
Related Assertions, automatically generated:
# File lib/selenium_on_rails/test_builder_accessors.rb, line 430 430: def store_selected_ids select_locator, variable_name 431: command 'storeSelectedIds', select_locator, variable_name 432: end
Gets option index (option number, starting at 0) for selected option in the specified select element.
Related Assertions, automatically generated:
# File lib/selenium_on_rails/test_builder_accessors.rb, line 444 444: def store_selected_index select_locator, variable_name 445: command 'storeSelectedIndex', select_locator, variable_name 446: end
Gets all option indexes (option number, starting at 0) for selected options in the specified select or multi-select element.
Related Assertions, automatically generated:
# File lib/selenium_on_rails/test_builder_accessors.rb, line 458 458: def store_selected_indexes select_locator, variable_name 459: command 'storeSelectedIndexes', select_locator, variable_name 460: end
Gets option label (visible text) for selected option in the specified select element.
Related Assertions, automatically generated:
# File lib/selenium_on_rails/test_builder_accessors.rb, line 472 472: def store_selected_label select_locator, variable_name 473: command 'storeSelectedLabel', select_locator, variable_name 474: end
Gets all option labels (visible text) for selected options in the specified select or multi-select element.
Related Assertions, automatically generated:
# File lib/selenium_on_rails/test_builder_accessors.rb, line 486 486: def store_selected_labels select_locator, variable_name 487: command 'storeSelectedLabels', select_locator, variable_name 488: 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 546 546: def store_selected_options locator, variable_name 547: command 'storeSelectedOptions', locator, variable_name 548: end
Gets option value (value attribute) for selected option in the specified select element.
Related Assertions, automatically generated:
# File lib/selenium_on_rails/test_builder_accessors.rb, line 500 500: def store_selected_value select_locator, variable_name 501: command 'storeSelectedValue', select_locator, variable_name 502: end
Gets all option values (value attribute) for selected options in the specified select or multi-select element.
Related Assertions, automatically generated:
# File lib/selenium_on_rails/test_builder_accessors.rb, line 514 514: def store_selected_values select_locator, variable_name 515: command 'storeSelectedValues', select_locator, variable_name 516: end
Determines whether some option in a drop-down menu is selected.
Related Assertions, automatically generated:
# File lib/selenium_on_rails/test_builder_accessors.rb, line 527 527: def store_something_selected select_locator, variable_name 528: command 'storeSomethingSelected', select_locator, variable_name 529: end
Gets the text from a cell of a table.
Related Assertions, automatically generated:
# File lib/selenium_on_rails/test_builder_accessors.rb, line 383 383: def store_table locator, row, column, variable_name 384: command 'storeTable', "#{locator}.#{row}.#{column}", variable_name 385: 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 331 331: def store_text locator, variable_name 332: command 'storeText', locator, variable_name 333: 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 607 607: def store_text_present pattern, variable_name 608: command 'storeTextPresent', pattern, variable_name 609: end
Gets the title of the current page.
Related Assertions, automatically generated:
# File lib/selenium_on_rails/test_builder_accessors.rb, line 287 287: def store_title variable_name 288: command 'storeTitle', variable_name 289: 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 315 315: def store_value locator, variable_name 316: command 'storeValue', locator, variable_name 317: 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 636 636: def store_visible locator, variable_name 637: command 'storeVisible', locator, variable_name 638: end
Determine whether current/locator identify the frame containing this running code.
This is useful in proxy injection mode, where this code runs in every browser frame and window, and sometimes the selenium server needs to identify the "current" frame. In this case, when the test calls select_frame, this routine is called for each frame to figure out which one has been selected. The selected frame will return true, while all others will return false.
NOTE: store_whether_this_frame_match_frame_expression is currently not supported by Selenium Core.
Related Assertions, automatically generated:
# File lib/selenium_on_rails/test_builder_accessors.rb, line 846 846: def store_whether_this_frame_match_frame_expression current_frame_string, target, variable_name 847: raise 'Not supported in Selenium Core at the moment' 848: end
Determine whether current_window_string plus target identify the window containing this running code.
This is useful in proxy injection mode, where this code runs in every browser frame and window, and sometimes the selenium server needs to identify the "current" window. In this case, when the test calls select_window, this routine is called for each window to figure out which one has been selected. The selected window will return true, while all others will return false.
NOTE: store_whether_this_window_match_window_expression is currently not supported by Selenium Core.
Related Assertions, automatically generated:
# File lib/selenium_on_rails/test_builder_accessors.rb, line 869 869: def store_whether_this_window_match_window_expression current_window_string, target, variable_name 870: raise 'Not supported in Selenium Core at the moment' 871: end