【发布时间】:2018-05-04 12:59:40
【问题描述】:
情况: 我正在使用带有参数的 POST 请求为 Web 应用程序编写自动化测试。 现在我正处于 Web 应用程序弹出确认窗口的位置,用户需要按 OK 才能继续。确认弹出窗口后,用户被重定向(响应代码 302)到另一个页面。 页面相关html代码如下
<input
id="Form:buttonFinishProcess"
name="Form:buttonFinishProcess"
value="Finish process"
onclick="return confirm('Are you sure? No more edits possible after exiting!');"
type="submit">
使用 Neoload 手动记录此过程时,请求如下所示
**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
自动发送此请求时,由于自动用户未确认弹出窗口,因此不会处理该请求。因此重定向不会在响应中发送,导致我的测试最终失败。
是否可以在 POST 请求中发送信息以确认弹出窗口?我在这里的可能性是什么,不仅关于 POST 请求,而且可能包括 javascript。或者:我可以绕过弹出窗口吗?
【问题讨论】:
标签: html testing post onclick neoload