18. Viewing the source code of the steps recorded using Selenium IDE in our desired language

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 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:

8. Observe that source code is displayed in HTML format as shown below:

9. For example I'm writing automation scripts in Selenium 2 in Java language, but how can this HTML code help me in understand the Selenium Command to be written in java language. It doesn't help, instead we've to view the source code in Java language. Follow the next steps to view the source code in Java language.

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:

14. Read the text on the Confirmation dialog and click on 'OK' button 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:

17. In the above identified line, I have identified that '.sendkeys' is the command to be used in order to type text into the text box using selenium as shown below. So now I can use this command '.sendKeys' if it is required any where while writing automation scripts without recording using Selenium 2.... :)

18. So, by following the above steps you can learn selenium commands which are required to perform various User Actions like typing text into the text box etc.

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.


Unknown said...

Hi Arun
I am new learner.
Finally i got my solution to change html.
Before that i never know we have to click in option to check Enable experimental features.
Thank you so much. :)

Arun Motoori said...

@ Pradeep :)

Unknown said...

Hi Arun,

Your posts are very helpful in learning and I am finding it very easy to learn. The site seems to be having issues. I do not see any images in the post. Could you please check and fix it.


Arun Motoori said...

@sri ram - May be your internet connection is slow. Please try my blog on your friend's machine who is having a good internet speed.

Unknown said...

Thanks Arun for such a wonderful blog. You have explained everything very precisely. I am thankful to my friend who suggested me to follow your blog.

Experiencing great learning..

Unknown said...

really amazing Arun....i waisted lot of time to search good site or blog to learn selenium,finally my journey stop to searching google...thnx arun again

Unknown said...

Hi Arun,
Is there any way where we can run the Selenium IDE window automatically from eclipse?I mean in order to run the events from eclipse we export the events as .java or other formats and load it into eclipse and run it from over there.So,is there any way where we can do it not by manually?In simple terms,is there a way where we can write a functionality that can control the selenium IDE window from eclipse?


Unknown said...

Hi Arun,
How you are doing Great!!!
Current I have Selenium IDE Version 3.5.8, But want an old version to check the Source Tab, AS I am unable to open "Java/Junit4/Webdriver" Format.
Thanks in advance!!

Arun Motoori said...

The older version is now deprecated and removed by the Selenium team itself. There is no way that we can get it back. Only option is use the latest version of Selenium IDE with all the features it is providing.

Unknown said...

Hi Arun

How to check the code in Java for latest version..

Arun Motoori said...


Check my new article -

Arun Motoori