0

This is a follow up to this question - Want to create a form filler - is java, jsp, html enough?. I am repeatedly filling a form on a website (Eg. private dentist reservation).

1 - For loop. For each iteration, all data is same except the value of a "dropdown box - state".

eg. "Text box - name", "text box - age" remain the same in each iteration. But, the state drop down changes to NY, TX, CA in an iteration.

2 - Perform an action (send mail) if certain text occurs in the final page.

How do I make selenium do all this ? Do I have to create a script for each state or there is a for loop ? Can Selenium do step 2 ?

Community
  • 1
  • 1
david blaine
  • 5,683
  • 12
  • 46
  • 55
  • They have the same issue to your other [question](http://stackoverflow.com/questions/17358228/java-and-selenium-for-web-form-filling) ....do it in Java (or another language). 1 & 2 are very easy and very possible in Java, but you are inherently limited in the IDE because it's meant to be a basic record & playback tool. The record & playback 'concept'/'model' falls over in your two scenarios above - so your answer to this and the other question is *ditch the IDE* and get **coding**. – Arran Jun 28 '13 at 09:01

1 Answers1

0
  1. You can get a loop with a the Flow control plugin for Selenium IDE. However, here begins the problem with Selenium IDE. The tool is really meant only for basic interactions - recording, playing, exporting. If you tried to incorporate some complicated logic, it would be very hard, unmaintainable and very often hacky.

    If you want to incorporate ... well ... any form of logic, you'll have to use any real programming language you want with Selenium Webdriver. This will enable you to do literally anything - full power of a programming language together with full browser control.

    A common practice is to record the basics in IDE, export it to WebDriver in your favorite language, and carry on from there.

  2. You can't do this in IDE. The only way I could think of is to store the text you want to send, record yourself sending a mail via a webmail, then playback it. But please, it's a hack and should not be done this way. Any decent language will enable you to send e-mails programatically.

Petr Janeček
  • 37,768
  • 12
  • 121
  • 145