PlainSeleniumTest reference

This page describes methods available in PlainSeleniumTest fixture of WebTest fixture library. The fixture is intended to be used as a direct gateway from FitNesse to Selenium Remote Console for Selenium Scripts, so that you can record a script using Selenium IDE and just paste it into FitNesse with minor changes. See How to test AJAX sites with FitNesse and Selenium for more information on this idea.

The main usage of this fixture is to directly expose Selenium Remote Control methods. For a full list of those methods, see Selenium RC JavaDoc. PlainSeleniumFixture is a SequenceFixture, so you can use FitLibrary keywords like show and check. For example:

showisElementPresentelement
checkgetValuefieldsome value

Unlike WebTest this class does provide any smart mapping to find elements by values, captions or contained text. You will have to specify locators manually. See the Selenium RC JavaDoc for detailed format explanations of locator identifiers. In general, if you are going to write tests manually, use WebTest. If you are going to record them using Selenium IDE, use this fixture.

After you copy the test script, remove the first row (test name), and the rest should be ready to use. Selenium Remote Console syntax differs in some parts from the Selenium syntax, so some methods might not be available straight away. If your test does not work because of a missing method, try to find an equivalent method in the JavaDoc API. As a general rule of thumb, methods that start with assert in Selenium start with get in Selenium RC; methods that start with verify in Selenium start with is in Selenium RC. So, instead of

verifyElementPresentelementTRUE

You can use

isElementPresentelement

For many of those cases, a workaround has been implemented in this fixture (like verifications explained below). The PlainSeleniumTest also implements additional wait methods that are not available in Selenium RC API. This fixture also contains wrappers for some methods that have a single argument, adding one more argument which is simply ignored. This is done so that you could copy and paste scripts directly from Selenium, because that will add one additional cell to two-cell rows. Note that the open method is also overridden so that the URL can be relative to the server specified in startBrowser (absolute URLs work fine as well).

Additional Methods

This is a list of methods that differ from the Selenium RC API.

  • open the browser (use this to start the test)
startBrowserbrowserremote control serverremote control porttest site url
  • close the browser (use this to finish the test)
shutdown browser
  • pause a given number of milliseconds
pausemilliseconds
  • set timeout for all waiting methods
set timeoutseconds
  • wait until text appears on the page
waitForTextPresenttext
  • wait for element to appear
waitForElementPresentelement
  • wait for an element to disappear from the page
waitForElementNotPresentelement
  • wait for field to get some value
waitForFieldValuefieldvalue
  • wait for a checkbox to be checked or unchecked. Pass false as third argument to wait for it to be unchecked.
waitForCheckedcheckboxTrue or False
  • list all options of a select box as a comma-separated string
showgetSelectOptionsselect box
  • check list of options in a select box
checkgetSelectOptionsselect boxcomma separated list of expected options

Personal Tools