A Web driver using Selenium.
Probe Type ID: selenium
Properties:
Name | Type | Default value | Description |
---|---|---|---|
rc_host |
string | localhost |
Selenium-RC hostname or IP address |
rc_port |
integer | 4444 |
Selenium-RC port |
browser |
string | firefox |
The browser Selenium should use on the Selenium host |
server_url |
string | None |
The server URL to browse when opening the browser. Providing it is mandatory. |
auto_shutdown |
boolean | True |
When set, Selenium closes the browser window when the test case is over. It may be convenient to set it to False to leave this window open to debug a test case on error. |
This probe enables to perform Selenium-based test through the Selenium Remote Control (RC) / Server.
It uses two kinds of command interfaces:
In both cases, some commands may return a result (for instance, isTextPresent returns a boolean result). You may expect such a result in a alt()
loop as usual.
The probe automatically starts the browser on the RC host as soon as it is mapped, and everything is cleaned up once the test case is over.
A basic example is available in samples/selenium.ats
.
Limitations: for now, only the “loose command” mode is implemented.
All platforms.
The probe needs a configured (and running) Selenium Server (provided by Selenium RC) that it can reach.[[BR]] You may install it on the host you want to run the browsers from.
If you are using Selenium IDE to record events from your browser, you can user the following formatter to generate Testerman code directly: Generate Testerman test cases with Selenium IDE.
The test system interface port bound to such a probe complies with the SeleniumProbePortType
port type as specified below:
type union SeleniumStrictCommand
{
record { charstring key, charstring value } addCustomRequestHeader,
record { charstring strategyName, charstring functionDefinition } addLocationStrategy,
record { charstring scriptContent, charstring scriptTagId } addScript,
record { charstring locator, charstring optionLocator } addSelection,
record { charstring allow } allowNativeXpath,
record {} altKeyDown,
record {} altKeyUp,
record { charstring answer } answerOnNextPrompt,
record { charstring locator, charstring identifier } assignId,
record { charstring fieldLocator, charstring fileLocator } attachFile,
record { charstring filename, charstring kwargs } captureEntirePageScreenshot,
record { charstring kwargs } captureEntirePageScreenshotToString, // then expect a response as charstring
record { charstring type } captureNetworkTraffic, // then expect a response as charstring
record { charstring filename } captureScreenshot,
record {} captureScreenshotToString, // then expect a response as charstring
record { charstring locator } check,
record {} chooseCancelOnNextConfirmation,
record {} chooseOkOnNextConfirmation,
record { charstring locator } click,
record { charstring locator, charstring coordString } clickAt,
record {} close,
record { charstring locator } contextMenu,
record { charstring locator, charstring coordString } contextMenuAt,
record {} controlKeyDown,
record {} controlKeyUp,
record { charstring nameValuePair, charstring optionsString } createCookie,
record {} deleteAllVisibleCookies,
record { charstring name, charstring optionsString } deleteCookie,
record {} deselectPopUp,
record { charstring locator } doubleClick,
record { charstring locator, charstring coordString } doubleClickAt,
record { charstring locator, charstring movementsString } dragAndDrop,
record { charstring locatorOfObjectToBeDragged, charstring locatorOfDragDestinationObject } dragAndDropToObject,
record { charstring locator, charstring movementsString } dragdrop,
record { charstring locator, charstring eventName } fireEvent,
record { charstring locator } focus,
record {} getAlert, // then expect a response as charstring
record { charstring attributeLocator } getAttribute, // then expect a response as charstring
record {} getBodyText, // then expect a response as charstring
record {} getConfirmation, // then expect a response as charstring
record {} getCookie, // then expect a response as charstring
record { charstring name } getCookieByName, // then expect a response as charstring
record { charstring locator } getCursorPosition, // then expect a response as integer
record { charstring locator } getElementHeight, // then expect a response as integer
record { charstring locator } getElementIndex, // then expect a response as integer
record { charstring locator } getElementPositionLeft, // then expect a response as integer
record { charstring locator } getElementPositionTop, // then expect a response as integer
record { charstring locator } getElementWidth, // then expect a response as integer
record { charstring script } getEval, // then expect a response as charstring
record { charstring expression } getExpression, // then expect a response as charstring
record {} getHtmlSource, // then expect a response as charstring
record {} getLocation, // then expect a response as charstring
record {} getMouseSpeed, // then expect a response as integer
record {} getPrompt, // then expect a response as charstring
record { charstring selectLocator } getSelectedId, // then expect a response as charstring
record { charstring selectLocator } getSelectedIndex, // then expect a response as charstring
record { charstring selectLocator } getSelectedLabel, // then expect a response as charstring
record { charstring selectLocator } getSelectedValue, // then expect a response as charstring
record {} getSpeed, // then expect a response as charstring
record { charstring tableCellAddress } getTable, // then expect a response as charstring
record { charstring locator } getText, // then expect a response as charstring
record {} getTitle, // then expect a response as charstring
record { charstring locator } getValue, // then expect a response as charstring
record { charstring currentFrameString, charstring target } getWhetherThisFrameMatchFrameExpression, // then expect a response as boolean
record { charstring currentWindowString, charstring target } getWhetherThisWindowMatchWindowExpression, // then expect a response as boolean
record { charstring xpath } getXpathCount, // then expect a response as integer
record {} goBack,
record { charstring locator } highlight,
record { charstring ignore } ignoreAttributesWithoutValue,
record {} isAlertPresent, // then expect a response as boolean
record { charstring locator } isChecked, // then expect a response as boolean
record {} isConfirmationPresent, // then expect a response as boolean
record { charstring name } isCookiePresent, // then expect a response as boolean
record { charstring locator } isEditable, // then expect a response as boolean
record { charstring locator } isElementPresent, // then expect a response as boolean
record { charstring locator1, charstring locator2 } isOrdered, // then expect a response as boolean
record {} isPromptPresent, // then expect a response as boolean
record { charstring selectLocator } isSomethingSelected, // then expect a response as boolean
record { charstring pattern } isTextPresent, // then expect a response as boolean
record { charstring locator } isVisible, // then expect a response as boolean
record { charstring locator, charstring keySequence } keyDown,
record { charstring keycode } keyDownNative,
record { charstring locator, charstring keySequence } keyPress,
record { charstring keycode } keyPressNative,
record { charstring locator, charstring keySequence } keyUp,
record { charstring keycode } keyUpNative,
record {} metaKeyDown,
record {} metaKeyUp,
record { charstring locator } mouseDown,
record { charstring locator, charstring coordString } mouseDownAt,
record { charstring locator } mouseDownRight,
record { charstring locator, charstring coordString } mouseDownRightAt,
record { charstring locator } mouseMove,
record { charstring locator, charstring coordString } mouseMoveAt,
record { charstring locator } mouseOut,
record { charstring locator } mouseOver,
record { charstring locator } mouseUp,
record { charstring locator, charstring coordString } mouseUpAt,
record { charstring locator } mouseUpRight,
record { charstring locator, charstring coordString } mouseUpRightAt,
record { charstring url } open,
record { charstring url, charstring windowID } openWindow,
record {} refresh,
record { charstring locator } removeAllSelections,
record { charstring scriptTagId } removeScript,
record { charstring locator, charstring optionLocator } removeSelection,
record {} retrieveLastRemoteControlLogs, // then expect a response as charstring
record { charstring rollupName, charstring kwargs } rollup,
record { charstring script } runScript,
record { charstring selectLocator, charstring optionLocator } select,
record { charstring locator } selectFrame,
record { charstring windowID } selectPopUp,
record { charstring windowID } selectWindow,
record { charstring logLevel } setBrowserLogLevel,
record { charstring context } setContext,
record { charstring locator, charstring position } setCursorPosition,
record { charstring pixels } setMouseSpeed,
record { charstring value } setSpeed,
record { charstring timeout } setTimeout,
record {} shiftKeyDown,
record {} shiftKeyUp,
record {} shutDownSeleniumServer,
record { charstring formLocator } submit,
record {} testComplete,
record { charstring locator, charstring value } type,
record { charstring locator, charstring value } typeKeys,
record { charstring locator } uncheck,
record { charstring libraryName } useXpathLibrary,
record { charstring script, charstring timeout } waitForCondition,
record { charstring frameAddress, charstring timeout } waitForFrameToLoad,
record { charstring timeout } waitForPageToLoad,
record { charstring windowID, charstring timeout } waitForPopUp,
record {} windowFocus,
record {} windowMaximize,
}
// With this "simplified" model, the command can be anything
// (assumed to be valid for Selenium), and its arguments
// are made of 0, 1 or 2 arguments (none, target, or target + value)
type union SeleniumLooseCommand
{
record { charstring target optional, charstring value optional } *,
}
type SeleniumProbePortType
{
in SeleniumStrictCommand;
in SeleniumLooseCommand;
out any; // depends on the invoked command
}