7p. Selenium IDE – Other Features

There are features all around you in the Land of Magic Meadows and it is making our lives all the more easier! I agree, we have covered a ton of features already, but there are these special two that I would like to highlight at this point.

Enabling experimental features

In our previous post, we saw how to export test cases to our desired programming language which are otherwise recorded in HTML by default. Imagine you not only wish to export but also like to see the exact code in your desired chosen language in the ‘source’ tab of the test script pane. You might want to explore and experiment a bit for whatever may be the reason.

Don’t worry… your wish is my command. Let me show you how we can achieve that right here and right now. Okay so how are we doing it? Simple. By checking a checkbox (I know that sounds witty…) which brags itself as, “Enable experimental features”!

Let us get into the details. Usually, upon clicking Options -> Format, you might see a message “Want the formats back? Click to read more” as shown below,

want formats

So, without the formats being visible how are we going to view the code of a language of our choice?

Hence, click on “Options -> Options…” and ‘Selenium IDE Options’ window opens. In ‘General’ tab, check “Enable experimental features” checkbox. Click ‘OK’ button. That’s it!

experimental features

Now the Format option shows the available formats to which a Selenium IDE test case can be converted to. HTML is the format chosen by default. Format gives a combination of the programming language to which the chosen test case will be converted/unit testing framework/the tool in the suite with which the code can be used.

available formats

Upon choosing the required format combination (“Java/ Junit4 / WebDriver” in this case), an alert appears.

format alert

A word of caution:
As you can see in the above image, this feature is marked experimental and that is done for a reason. It is always recommended to use the ‘Export Test Case As’ feature in the File menu to convert the test case to another language. It is usually warned not to use ‘Format’ menu item unless you really really really want it.

Curious to know why all this complication for something that looks so simple? Let’s see… Selenium IDE can ONLY work with HTML based Selenese. So when this feature is turned on, it shows the code in selected language as if its recording in that language. But no! What is really happening is, in the background, it maintains a copy of the test case and converts on the go to the chosen language and displays that to you. The sad part here is, this ‘Format’ feature is not known to be very stable. Once you save the test case and try to re-open, it might or might not happen. Mostly it does, but I have noticed that the playback option gets disabled. Additionally, it is not only quite difficult to make changes but also changes made are lost when format is again changed. It is your call now!

Anyways if you have decided to proceed and experiment around a bit, go ahead and click ‘OK’ in the alert box and notice that the Table view pane is disabled.

But Voila! The Source view pane now shows the test case in chosen format!!

JUnit test case

Easy way of generating commands

A major activity involved in Selenium is identifying web elements using different locators. Selenium IDE does this automatically for you. But there can be cases where you might want to insert a new command (along with the auto generated code obtained as a result of record activity) for assertions, verifications etc. In such cases, instead of using inspect element functionality to locate a web element and then struggling with the right command syntax, we have a shortcut. Right click! You heard me right.

Right clicking on the element in the web page (obviously in Firefox browser!) upon which you wish to perform the action, would automatically open a menu suggesting most of the possible selenium commands that work with the chosen element. To get an entire list, just click on “Show Available Commands” option.

The only catch here is: Selenium IDE should be open. It is not required to turn on ‘record’ mode. Just opening IDE window would be sufficient.

generating commands

Hope that was of some help! So, see you again in another post.

Have a great day!

Series Navigation<< 7o. Selenium IDE – Export test cases in desired language7q. Selenium IDE – A quick peek at Plugins >>
By | 2017-07-10T19:17:45+00:00 October 28th, 2016|Selenium|0 Comments

About the Author:

Lakshmi Chandana is a Software professional + passion-fueled blogger + novel-reader + artist + tutor to make your day a little brighter than it was before! She is thrilled you are here! She is on a mission to make sure learning sticks but with the fun part kept intact. She uses certain tricks called BrainBells (inspired from barbells and dumbbells used for a workout) to achieve this and she says, “this is not the hardest job! As once minions said, it for sure is working in a bubble wrap factory. Imagine the self-control needed!” So, dive in to explore the fun-filled World of Selenium!!

Leave A Comment