In the previous post we discussed about a breif history and the architecture of Selenium. In this post we will discuss about Selenium IDE and its commands called as “Selenese”. Selenium IDE is firefox plugin to record and play back user interaction of the web browser. Selenese are commands tells what to do on the web browser.
Only prerequisite tool to install Selenium IDE is Firefox and then next install the plugin/extension in Firefox.
There are three flavours of commands.
- Actions are commands that generally manipulate the state of the application. If an action stops/fails execution due to error then test is stopped
- Accessors evaluate the state of the application and store results in a variables and can be used for assertions.
- Assertions enable us to verfiy the state of an application with expected result.
Its command structure is as follows
Command [Target] [Value]
- Command
- Target (optional depending upon the command & need)
- Value (optional depending upon the command & need)
Command example
openWindowAndWait http://zealups.com
Here openWindowAndWait is command
http://zealups.com is Target
Lets see this in action Open Tools -> Web Developer -> Selenium IDE menu in Firefox web browser. A window similar to the below screenshot will open
- Now right click on the first grid which you see and click on Insert New Command
- Next fill in Command text box with openWindowAndWait
- Next fill in Target text box http://zealups.com or any other URL
- Next is click on the Play on current test case. It will open a new firefox window and navigate to the URL specified in the Target.
Once you are done with the test case’s & test you can save the work by clicking on File -> Save Test Case. The file format in which it save is HTML which you can open it web browser like normal HTML files. Another option we have is you can export the test case to C#, Java, Python & Ruby source codes.
What we have seen is a manual way of performing a test which is time consuming unless you know all the commands. Previously I was mentioning about recording this can be acheived by clicking on the record button and next perform all the actions.
Nice. Good job