roland
roland

Reputation: 617

Interacting with alert/prompt popup window with python

I'm trying to test an application where a user enters information into a gui, clicks on save button and then has to click "ok" in an alert/prompt popup window for the request to take place to the web service.

I'm using a python script to automate the requests to the web service.

My question is: after submitting the user information how can I interact with the alert/prompt popup to click the "ok" button so that the request completes. How is this being done within a python script.

I'm grateful for any input

Upvotes: 3

Views: 3143

Answers (2)

0xc0de
0xc0de

Reputation: 8287

If it is using web browser or any XHTML+ javascript based layout engine(webkit, KHTML, gecko), you can use selenium

homepage

see also

there are also others like

windmill

twill

and pamie for windows

I have used selenium which is pretty good.

Upvotes: 1

shadyabhi
shadyabhi

Reputation: 17234

Javascript is just a client-side thing. It doesn't matter what you select in the alert box. If you press Cancel, it won't happen but if you press OK, it will POST the form data.

You don't need to emulate a button press of OK. So, what really matters is to sniff the POST data. For that you can use Firebug (in Firefox) or Developer Tools (in Chrome) to sniff the POST parameters by using the Network tab.

Upvotes: 1

Related Questions