gpt4 book ai didi

html - 使用发布请求确认 onclick 确认对话框

转载 作者:行者123 更新时间:2023-11-28 02:31:50 25 4
gpt4 key购买 nike

情况:我正在通过使用带参数的 POST 请求为 Web 应用程序编写自动化测试。现在我正处于 Web 应用程序弹出确认窗口的位置,用户需要按确定才能继续。确认弹出窗口后,用户将被重定向(响应代码 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。或者:我可以绕过弹出窗口吗?

最佳答案

Neoload 不充当浏览器,因此这完全取决于正确记录和发送 http 请求。

所以再次记录并检查页面(如果有)和弹出窗口触发的请求有何不同

关于html - 使用发布请求确认 onclick 确认对话框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50175579/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com