Excerpt |
---|
Test the values and state of HTML elements and controls. |
...
Command | Explanation | |
---|---|---|
test that <locator> < | test that checkbox "Accept Terms" is checked | Passes if the checkbox is checked |
test that <locator> < | test that checkbox "Subscribe me to the newsletter" is not checked | Passes if the checkbox is not checked |
test that <locator> < | test that button "Submit" has class "selected" | Passes if the element has the given class (possibly among others). |
test that <locator> < | test that button "Submit" does not have class "selected" | Passes if the element does not have the given class. |
test that <locator> < | test that button "Submit" has classes "selected" and "disabled" | Passes if the element has all of the given classes (possibly among others). |
test that <locator> < | test that button "Submit" does not have classes "selected" and "disabled" | Passes if the element does not have all of the given classes. If the element has any subset of the listed classes, but not the full set, the command fails. In the example at left, if the button has class "selected" but not "disabled" the command will fail. |
test that <locator> < | test that textbox "Description" is empty | Tests that any value-bearing element has a value. In this example, text box "Description" has a value. |
test that <locator> < | test that textbox "Description" is not empty | A value-bearing element is not empty if it contains any non-whitespace characters. |
test that <locator> < | test that checkbox "Accept Terms" is enabled | Passes if a control that can be enabled/disabled is, in fact, enabled. Elements that cannot be enabled/disabled (e.g., divs) are always enabled (if they exist). |
test that <locator> < | test that checkbox "Accept Terms" is disabled | Passes only if the control can be enabled/disabled, and is, in fact disabled. Elements that cannot be enabled/disabled (e.g., divs) are always enabled (if they exist). |
test that <locator> < | test that element at xpath "//div[@id='notification']/span" exists | Passes if exactly one matching element exists on the page. If there are no matching elements, or multiple matching elements, this command will fail. If the application under test dynamically adds elements to the page in response to the user's actions, you may want to give the browser some time to complete the addition. See the |
test that <locator> < | test that element at selector "div.queryResults" does not exist | Passes if there is not exactly one matching elements on the page. If there are no matching elements, or multiple matching elements, this test will fail. If the application under test dynamically adds elements to the page in response to the user's actions, you may want to give the browser some time to complete the addition. See the |
test that <locator> < | test that element at selector "div.adminTab" is visible | Test whether an element is visible or hidden. An element that is visible on the page, but not shown in the current viewport (e.g. because it has not been scrolled into view), is visible. Both tests will fail if the element does not exist. |
test that <locator> < | test that element at selector "div.adminTab" is hidden | |
test that <locator> < | test that radio button "Male" is selected | Test whether a radio button is selected or not. Both tests will fail if the element does not exist. |
test that <locator> < | test that radio button "Female" is not selected | |
test that <locator> < | test that textbox "Name" equals "Nikola Tesla" | Test whether an element's value equals, starts with, ends with, or contains a value (or not). Comparisons are case sensitive. These will all fail if exactly one of the element indicated is not found. |
test that <locator> < | test that textbox "Name" does not equal "Thomas Edison" | |
test that <locator> < | test that textbox "Name" starts with "Nikola" | |
test that <locator> < | test that textbox "Name" does not start with "Thomas" | |
test that <locator> < | test that textbox "Name" ends with "Tesla" | |
test that <locator> < | test that textbox "Name" does not end with "Edison" | |
test that <locator> < | test that textbox "Name" contains "la Tes" | |
test that <locator> < | test that textbox "Name" does not contain "mas Ed" | |
test that <locator> < | test that textbox "Name" matches "(\w+)\s+(\w+)" | Tests whether the value of an element matches Java regular expressions, or not. The locator must return exactly one element, or these tests will fail. |
test that <locator> < | test that textbox "Name" does not match "(\w+)\s+Edison" |