Python simulate browser activity
rosuav at gmail.com
Fri Mar 16 20:20:17 CET 2012
On Fri, Mar 16, 2012 at 1:23 PM, choi2k <rex.0510 at gmail.com> wrote:
> The application aims to simulate user activity including visit a
> website and perform some interactive actions (click on the menu,
> submit a form, redirect to another pages...etc)
> I have found some libraries / plugins which aims to simulate browser
> activity but ... none of them support AJAX request and/or running
> Here is one of the simple tasks which I would like to do using the
> redirected, load the new page content
To the web server, everything is a request. Don't think in terms of
even a web browser. There's just a TCP socket connection and an HTTP
request. That's all you have.
On that basis, your Python script most definitely can simulate the
request. It needs simply to make the same HTTP query that the
that request would be. If you can use a non-SSL connection, that'll
make your job easier - just get a proxy or packet sniffer to monitor
an actual web browser, then save the request headers and body. You can
then replay that using Python; it's not difficult to handle cookies
and such, too.
Hope that helps!
More information about the Python-list