views:

131

answers:

1

A customer has a legacy web application which is used mainly to capture information. The application has no other interfaces available e.g. web services, API’s.

Typical workflow:

  • First form: Select “Action Type” of “Payment” via radio button. Select “Enter”
  • Second form: Select “Payment Type” of “Fine” via radio button. Select “Enter”
  • Third form: Select “Fine Type” of “Parking” via radio button. Select “Enter”.
  • Fourth form: Enter parking fine number. Select “Enter”.

Back end system looks up the amount for this parking fine number.

  • Fifth form: Display summary of details. Select “Enter”. Pop-up “Confirm you wish to pay fine amount of xx.xx via credit card”. Select “OK”.
  • Sixth form: Enter credit card details. Select “Enter”.
  • Seventh form: Confirmation.

For various reasons, the customer wants to provide these details via a file. So we would read a record and plug-in the details into the relevant fields as above.

We could capture a work flow via something like Selenium but we would need someway of modifying the “scripts” since the details are different for each record in the file.

We could perhaps send a series of HTTP Posts?

The solution must run in all browsers and the customer doesn’t want to have to install plug-ins etc, on all user PC’s.

No restriction of how to deliver this e.g. we could use Java, C# (preferred) or anything else.

Any suggestions or advice from anyone who has done something like this?

+2  A: 

You will want to do this without a browser, using HTTP POST requests. A scripting language such as Perl, Python etc. would be a good choice in terms of simplicity - in this case the actual code would probably take no more than 30-so lines.

You would essentially have to:

  1. potentially issue one initial (setup) POST (username+password) to simulate a human agent logging in

then,

  1. read a set of parameters from the input file
  2. issue a first POST with the first form's subset of parameters (e.g. action type)
  3. read applicable <input type="hidden" name="..." value="..."> tags from the POST reply, if any
  4. issue a second POST with the second form's subset of parameters (e.g. payment type), as well as any name=value pairs read from the POST reply in the step immediately above
  5. read applicable <input type="hidden" name="..." value="..."> tags from the POST reply, if any
  6. issue a third POST with the third form's subset of parameters (e.g. fine type), as well as any name=value pairs read from the POST reply in the step immediately above
  7. etc.
  8. repeat for the next set of parameters from your input file

You may also have to instruct your HTTP library not to throw cookies away, if not configured as such by default/already.

Cheers, V.

vladr
+1 Because you do want to do it without a browser. However, pretty much any modern language (java, .net) can handle the http posts pretty easily.
Chris Lively
@Chris, I agree; however I stand by my recommendation for the use of scripting for these particular kinds of applications as a natural and ideal choice (should the person ultimately developing and/or maintaining it have the necessary scripting know-how, that is.)
vladr