While working with Selenium 2 in future,we've to know how to write automation scripts by hand i.e. without recording . For example if you want to know how to write automation script for 'typing text into the search text box in Google Page' user action. But you don't know the Selenium command which types text into the text box. Lets find out the command using Selenium IDE Recording feature and use it in Selenium 2 in future.
1. Launch Selenium IDE from Firefox Browser -> Tools Menu
2. Ensure that the Selenium IDE is launched and Record button is enabled by default
3. Type www.google.com in the Firefox Browser -> Address bar and Press Enter key on the keyboard
4. In Google page, Type 'Selenium-automation-by-arun' text in the search box and click on 'Google Search' button
5. Click on 'Record' button to stop recording and ensure that the following commands are displayed under the Selenium IDE -> Table tab as shown below:
6. Now lets see the source code of the above recorded steps by following the next steps.
7. Maximize the 'Selenium IDE' and click on 'Source' Tab as shown below:
10. Select 'Options' option from the Selenium IDE -> Options Menu -> Options as shown below:
11. Ensure that 'Selenium IDE Options' pane is displayed and select the 'Enable experimental features' check box option to enable as shown below:
12. Click on 'OK' button on the 'Selenium IDE Options' to save the changes made to the options
13. Select 'Java/Junit4/WebDriver' option from the Selenium IDE -> Options Menu -> Format as shown below:
15. Ensure the code displayed under the 'Source' tab is now changed to Java as shown below:
16. Search for 'selenium-automation-by-arun' text in the Java source code to identify the line which has text typing command. I've identified this text in the Java source code as shown below:
19. After you finish viewing the source code in Java, please switch back the language format from Java to HTML. Until and unless you change the language format again to HTML, Recording options wont work and also 'Table' tab wont be clickable. (So click on Selenium IDE -> Options Menu -> Format -> HTML option to switchback to HTML)
As we've got enough knowledge required on the Selenium IDE, we can now move forward to learn the concept of Locators in the upcoming posts.
Please comment below to feedback or ask questions.
How to use Locators will be explained in the next post.