02 Mrz

Selenium IDE – useful for small automation tasks

Selenium IDE is the most useful testing tool. It exists as Firefox plugin and is able to record your actions in the browser to save you from monotonously testing a web application. But sometimes Selenium IDE can help you with other automation tasks.

Here is one example: Google records every search you conduct while logged in. You can view your history here: https://history.google.com/history

If you have a lot of items in Google history and want to delete them at all, there isn’t a simple button ‘clear all’, but don’t worry. You can record these next four commands using Selenium IDE:

label | start

click | id=selector_top

clickAndWait | name=btnD

gotoLabel | start

Last but not least you finally fill the field “Base URL”: https://history.google.com/history Then start your script and enjoy!

clean google history

It looks so simple and works well, but there is one problem here: It only cleared the first page of history. And Selenium IDE hasn’t got any loop-commands. It doesn’t understand the command ‘label’ and ‘gotoLabel’.

You’ll tell yourself “Who cares?”, I’ll just replay “don’t worry”. But it gets better: Selenium IDE is an extendable tool. You can extend it with JavaScript with any functionality you want. Go to https://github.com/73rhodes/sideflow, save sideflow.js locally and then put it into the field “Selenium Core extensions (user-extensions.js)” in the Selenium IDE Options:

set sideflow script

 

Now, if you restart Selenium IDE, you’ll get a lot of loop-commands. Enjoy Selenium IDE and be happy!

Share this

Leave a reply