Karla News

Automate Your Web Browser Actions by Selenium

Selenium

Have you been tired about some boring repeated actions with web browsers like login some sites or click top 20 your favourite fashion news? Yes, doing manually is a waste of time. Today, please let me show how to automate your web browser actions by Selenium.

Selenium is an open source toolkit for web applications automation test, supporting almost all types of web browsers like IE, Firefox, or Opera. Selenium can drive web browsers to simulate human actions like clicking a button, input data etc, also support recording users’ operations and translating actions scripts to code of several programming languages such as Java, Python… In one word, Selenium is an powerful toolkit for professional software test, but it’s also easy enough to use by usual web users.

Selenium Homepage is here: http://seleniumhq.org

Selenium contains several components: Selenium RC, Selenium IDE, Selenium Core… As our surf automation purpose, we can finish it by Selenium IDE. Selenium IDE is a plug in for Firefox, provides friendly interfaces to record and drive functions. OK, let’s begin now:

  1. Download Selenium IDE here, and when download is complete, Firefox will prompt if install this plug in, choose YES, then Selenium IDE will soon be installed in a while.
  2. After you restart your Firefox, you will find Selenium IDE at Menu->Tools->Selenium IDE.If you are ready to record your repeated actions, please start by click it.
  3. When you open main UI of Selenium IDE, as you can see, the top-right red circle button is keeping pushed, which means now Selenium IDE is ready to detect all browser actions from you.
  4. Next, let me take a google search for example. I type www.google.com in Firefox, go. At simple search input control, I type “Associated Content”, click search button. And get results.
  5. I go back to Selenium IDE, and stop recording. Then you will find all actions just now has been written as scripts by Selenium IDE, each line contains operation information: command, target,value. “Command” stand for user’s operation, like click, input data etc. “Target” means which web control you operated on. If you choose “source “tab ,you will see html codes.
  6. After recording, please set a time interval between each actions, maybe you want to see a slower or quicker automation screen, so right click-> Insert New Command, type “SetSpeed” for command, set “15000” for Target, 15000 means time interval is 15 seconds.
  7. All are ready, now just click the “Play the current test case”, you will see Firefox automatically go to google, and type “Associated Content”, search. All of these actions is done by browser itself without your attention. Yes, you could have a cup of coffee, and focus on valuable work you like.please remember save the scripts on your local hard disk in case of next use.
See also  Ten Great Retirement Gifts for a Retiree

Now you can automate your repeated work by Selenium, in fact Selenium can do much more than what we have done, but for our common web users, the basic automation function has much met our requirements .