...
Actions | Keyboard & Mouse interaction | Verification and Assertion | Waits | Scenario Flow | JS Execution | Stored Variables | Custom (ASM Specific) Commands |
---|---|---|---|---|---|---|---|
open | keyDown | assertElementPresent | waitForVisible | gotoIf | fireEvent | storeTitle | setPageBreak |
clickAndWait | keyDownAndWait | assertTitle | waitForText | goto | runScript | storeXpathCount | insertPageBreak |
clickAtAndWait | keyUp | assertLocation | waitForValue | label | getEval | storeCssCount | takeScreenshot |
click | keyUpAndWait | assertVisible | waitForAttribute | close | runScriptAndWait | storeValue | startRecording |
clickAt | keyPress | assertElementNotPresent | waitForNotText | pause | storeText | clearRecording | |
type | keyPressAndWait | assertNotVisible | waitForNotValue | setSpeed | storeLocation | stopRecording | |
sendKeys | mouseOver | assertAttribute | waitForNotAttribute | setTimeout | storeExpression | getDictionary | |
typeKeys | assertNotAttribute | waitForTextPresent | echo | storeEval | |||
select | assertValue | waitForTextNotPresent | storeAttribute | ||||
selectAndWait | assertNotValue | waitForElementPresent | storeElementPresent | ||||
selectFrame | assertText | waitForEditable | store | ||||
selectWindow | assertTextNotPresent | waitForElementNotPresent | |||||
submit | assertTextPresent | waitForNotVisible | |||||
assertExpression | waitForTitle | ||||||
assertNextConfirmation | waitForLocation | ||||||
assertNextAlert | waitForAlert | ||||||
assertAlert | waitForConfirmation | ||||||
assertConfirmation | |||||||
assertEval | |||||||
verifyTitle | |||||||
verifyLocation | |||||||
verifyElementPresent | |||||||
verifyVisible | |||||||
verifyElementNotPresent | |||||||
verifyNotVisible | |||||||
verifyAttribute | |||||||
verifyNotAttribute | |||||||
verifyValue | |||||||
verifyNotValue | |||||||
verifyText | |||||||
verifyTextNotPresent | |||||||
verifyTextPresent | |||||||
verifyExpression |
Usage Assertion Modes
In order to assert a command within Selenium IDE, you can use the assert
, verify
, or waitFor
commands; the assert
command will stop the Selenium IDE script if the expected condition is not met, while the verify
command will log an error message but not stop the script. ASM scenarios, by contrast, treat the assert
and verify
commands the same way - if the expected condition is not met, both commands will result in a failure of the scenario.
By contrast, the behavior of the waitFor
command is the same within Selenium IDE and ASM Scenarios. Within both tools, the waitFor
command will wait for a specified element and will result in a script failure if the element is not found within the specified timeframe. The default timeframe is 30 seconds and can be changed with “setTimeout”.
Custom ASM Commands
ASM supports several commands which are not utilized in native Selenium IDE: insertPageBreak, takeScreenshot, and getDictionary.
...
The command takeScreenshot
takes a screenshot that will be visible in the Check Details. The command will insert an additional screenshot onto the page in addition to whatever screenshots have been added in the Edit Check settings. This command is helpful when troubleshooting scripts as it gives a snapshot of what exactly happens at a particular step.
getDictionary
See Storing and Retrieving Information Using the ASM Dictionary.
...
When using sendKeys in Selenium IDE, the key codes ${KEY_ENTER}
, ${KEY_SHIFT}
, and ${KEY_LEFT}
are not valid commands within Selenium IDE. Instead use keyPress
with . Use keyPress
or keyPressAndWait
(if the keystroke triggers a new page load) instead. When entering a keystroke, use the respective ASCII values for the key you want to be pressed. For example, if you want to press Enter within an application, use the command keyPress
and the value \13
.
Command | Target | Value |
| | |
JavaScript Execution
Selenium WebDriver’s JavascriptExecutor
will wrap all JS JavaScript and evaluate it as an anonymous expression. This means that you need to use Therefore, the “return” keyword :must be used when executing JavaScript within the “Target” field in an ASM scenario. For example, the command browserbot.getCurrentWindow().document.title
in Selenium becomes return document.title;
The same is true when evaluation expressions using storeEval or assertEval:
Selenium IDE
...
assertEval
...
in an ASM Scenario.
If your Selenium IDE looks like the following:
Command | Target | Value |
|
|
|
...
Add a “return” keyword to the target so it looks like the following:
Command | Target | Value |
| \{\{ |
|
Note that there are multiple commands that will result in javascript evaluation: gotoIf
, assertEval
, getEval
, and storeEval
.
Key Strokes
If you need to simulate a keypress input event, such as pressing the enter key, you must use keyPress
or keyPressAndWait
(if the keystroke triggers a new page load), with the ASCII as an argument. For example: Press enter key and wait for new page load
keyPressAndWait
id=gh-ac
\13
Return Required
ASM Scenario commands which execute JavaScript snippets expect a returned value. The following commands result in javascript evaluation /or expect a javascript snippet as an argument, which must include the 'return' keyword at the start of the expression within the “Target” field. Therefore, they also require the use of “return”:
GotoIf
RunScript
RunScriptAndWait
...
Info |
---|
Knowing how to increment a value is useful when running through a loop in an ASM script! |
Usage Assertion Modes
In order to assert a command within Selenium IDE, you can use the assert
, verify
, or waitFor
commands; the assert
command will stop the Selenium IDE script if the expected condition is not met, while the verify
command will log an error message but not stop the script. ASM scenarios, by contrast, treat the assert
and verify
commands the same way - if the expected condition is not met, both commands will result in a failure of the scenario.
By contrast, the behavior of the waitFor
command is the same within Selenium IDE and ASM Scenarios. Within both tools, the waitFor
command will wait for a specified element and will result in a script failure if the element is not found within the specified timeframe. The default timeframe is 30 seconds and can be changed with “setTimeout”.