Skip to content Skip to sidebar Skip to footer

Web Automation - Dealing With .aspx

I'm trying to accomplish a little bit of automation which includes submitting a form on a webpage. The values for the form are already coded per item in the list. I've tried many d

Solution 1:

you would need to parse/parameterize your post headers and contents. this can be non-trivial.

check out mechanize for access at the HTTP level, with some form handling convenience.

check out selenium, for driving a real browser in Python.


Solution 2:

I don't think aspx has anything to do with it.

Have you tried http://pypi.python.org/pypi/selenium ?


Solution 3:

Indeed, the server-side handling of the POST request won't work if those hidden values aren't present. ASP.NET uses that stuff to track statefulness across multiple requests. Reverse-engineering ASP.NET Web Forms HTTP requests isn't a fun endeavor.

You'll probably need to request the page, scrape the hidden values it gives you, and include those in the POST.

Stepping through a manual interaction with the page and capturing requests/responses in something like FireBug will also give you a good idea of the values being sent back and forth between the client and the server. It wouldn't surprise me if there's some JavaScript emitted to the response which dynamically modifies some hidden fields in server-pre-determined ways as well, helping to indicate which button was pressed or which control was in some way modified.


Solution 4:

Asp.net has a feature called viewstate (encrypted page state settings) which you can't fake, and which the page may be using by default and will expect to see on post to the form when submitting back to itself (called post back).

If you control the .aspx code it likely has an associated .cs or .vb file with the code to do the form processing. You can change the code to get values from posted form or URL parameters instead of (or in addition to) controls on the original form. If the site is compiled and you don't see any .vb or .cs files to change you would need to locate the original source files for the solution.


Post a Comment for "Web Automation - Dealing With .aspx"