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,
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!
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. The 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.
Upon choosing the required format combination (“Java/ Junit4 / WebDriver” in this case), an alert appears.
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 it’s 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 the 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!!
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.
Hope that was of some help! So, see you again in another post.
Have a great day!
Hi ,
I am not getting this options button on selenium IDE 3.3
Hi Alina,
Yes, the latest version of Selenium IDE has a limited set of features. Exporting a test case in the desired language is not yet available and they are working on it.
I would not really recommend downloading an older version but if you want to follow along, please use this link, https://addons.mozilla.org/en-GB/firefox/addon/selenium-ide/versions/ to get the previous versions of IDE.
Thanks.