Trace: » calculatefixture » pyfit » testingasimplequery » connecttothedatabase » start_using » download » webtest_reference
WebTest Reference
This page lists all available methods in the WebTest fixture for customer-friendly web testing through FitNesse and Selenium. See main WebTest page for more information (especially on getting started). Method arguments are marked as bold.
WebTest does a lot of smart mapping to identify fields, button and elements by captions, names, DOM element IDs and contained text. In most cases, you should be able to identify any element by the text that is actually displayed to the user on the screen. You can also use the DOM element ID (tests will run faster if you do).
Browser operations
- Start the browser (call this method to initialise the test)
| start browser | browser name | with selenium console on | selenium rc host | at port | selenium rc port | and scripts at | test site url |
- Shut down the browser (call this method on the end of the test)
| shutdown browser |
- navigate to a URL during the test (change active page)
| user opens url | test site url |
- check current browser URL
| page url is | some url |
- check that the page loads fully within given time (use after user opens url)
| page reloads in less than | time | seconds |
Page validations
- check that page contains some text (regardless of whether text is visible or not)
| page contains text | some text |
- check that text does not appear anywhere on the page (including hidden parts)
| page does not contain text | some text |
- check that page contains an element (hidden or visible)
| page contains element | element |
- check that page does not contain an element (hidden or visible)
| page does not contain element | element | |
| element | element | is visible |
- check whether an element exists but is hidden
| element | element | is not visible |
- check whether an element is disabled
| element | element | is disabled |
- check whether an element is enabled
| element | element | is enabled |
- check whether a button is disabled (can also locate buttons by captions/values)
| button | button | is disabled |
- check whether a button is enabled (can also locate buttons by captions/values)
| button | button | is enabled |
- check whether a check box is disabled (can also locate check boxes by values)
| check box | check box | is disabled |
- check whether a check box is enabled (can also locate check boxes by values)
| check box | check box | is enabled |
- check whether a check box is checked (confirmed)
| check box | check box | is checked |
or
| check box | check box | is selected |
- check whether a check box is not checked (confirmed)
| check box | check box | is not checked |
or
| check box | check box | is not selected |
- check whether a radio button is selected (confirmed)
| radio button | radio button | is checked |
or
| radio button | radio button | is selected |
- check whether a check box is not checked (confirmed)
| radio button | radio button | is not checked |
or
| radio button | radio button | is not selected |
- check whether a field is editable
| field | field | is editable |
- check whether a field is disabled (not editable)
| field | field | is not editable |
| field | field | is empty |
- check whether a text field or area contains given text (as a substring)
| field | field | contains text | text |
- check whether an element contains given text (as a substring). this can be used to check for text labels.
| element | element | contains text | text |
- check value of an input element
| check | value of | field | is | text |
- check text in a DOM element (can be used to check for labels)
| check | text in | element | is | text |
- check that a JavaScript alert pops up with a given message (will confirm the alert as well)
| alert is | message |
or (this will also print the current value if it is different then expected)
| check | alert | message |
- print the current JavaScript alert, and confirm it
| show | alert |
- check that a JavaScript confirmation pops up with a given message (will confirm the box as well)
| check | confirmation | message |
- print the current JavaScript confirmation, and confirm it
| show | confirmation |
- check the selected option in a select/drop-down box by label
| check | selected option in | select box | is | value |
- list available options in a drop down box (the second row must contain text value, this is an ArrayFixture)
| list | select box | contains options |
| value | ||
| value 1 | ||
| value 2 | ||
| … | ||
or
| drop down | select box | contains options |
| value | ||
| value 1 | ||
| value 2 | ||
| … | ||
Actions
- trigger a DOM event manually. Don't prefix the element with on (use change and not onchange). You can fire any applicable DOM event with this.
| fire event | event name | for | page element |
- click on any element
| user clicks on | page element |
- click on a button (will fail if the element is not a button). This method can locate buttons by value as well.
| user clicks on | button | button |
- click on a check box(will fail if the element is not a check box). This method can locate check boxes by value as well.
| user clicks on | check box | checkbox |
- click on a radio button(will fail if the element is not a radio button). This method can locate radio buttons by value as well.
| user clicks on | radio button | radio button |
- select an option from a select/drop-down box
| user selects | option | from | select box |
- type text into a text field
| user types | text | into field | field |
Asynchonous (AJAX) validations
- pause for a number of seconds
| pause | time | seconds |
- wait for an element to appear
| wait | time | seconds for element | element | to appear |
- wait for an element to disappear
| wait | time | seconds for element | element | to disappear |
- wait for text to appear anywhere in the page (visible or hidden)
| wait | time | seconds for text | text | to appear |
- wait for text to disappear from the page (visible or hidden)
| wait | time | seconds for text | text | to disappear |
- wait for an input field to get certain value
| wait | time | seconds for field | field | to contain text | text |
- wait for an element to contain certain text
| wait | time | seconds for element | element | to contain text | text |
