vendredi 4 mai 2018

Confirming onclick confirmation dialog with post request

Situation: I am composing an automated test for a web application by using POST requests with parameters. Now i am at a point where the web application pops up a confirmation window and the user needs to press OK in order to proceed. After confirming the popup, the user is redirected (response code 302) to another page. The relevant html code of the page is the following

<input 
id="Form:buttonFinishProcess" 
name="Form:buttonFinishProcess" 
value="Finish process" 
onclick="return confirm('Are you sure? No more edits possible after exiting!');" 
type="submit">

When recording this process manually using Neoload, the request looks like this

**Header**
POST http://domain.de:port/.../finishprocess.xhtml HTTP/1.1
Accept: text/html, application/xhtml+xml, image/jxr, */*
Accept-Encoding: gzip
Accept-Language: en-US
Content-Type: application/x-www-form-urlencoded
Pragma: no-cache
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko
Host: domain.de:port
Content-Length: 305
Cookie: JSESSIONID=...
**Body**
Form:buttonFinishProcess=Finish process

When sending this request automatically, the request is not processed as the automated user does not acknowledge the popup. Thus the redirect does not get sent in the response, making my test fail in the end.


Is it possible to send information inside the POST request to confirm the popup ? What are my possibilities here, not only regarding the POST request but maybe including javascript. Or alternatively: Can i circumvent the popup at all ?

Aucun commentaire:

Enregistrer un commentaire