使用Jmeter填写表格?
谁能帮我弄清楚如何使用 jmeter 并强制它自动填写并提交表单?例如,我需要填写谷歌搜索框,然后单击手气不错按钮?
Can anyone help me figure out how to use jmeter and force it to fill out and submit a form automatically? For example, I need to fill out the google search box and then click the I'm Feeling Lucky button?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Google 不是一个很好的例子,因为它使用 GET 作为表单。例如,要搜索“jmeter”并按“幸运”按钮,您只需发送以下 URL:
http://www.google.com/search?hl=en&source=hp&q=jmeter&oq=&btnI=1
要发表真正的帖子,您需要从跟踪中或通过查看 HTML 源代码找到表单控件字段名称,然后执行类似此处所示的操作。用户名/密码是要发布的字段名称。该操作是 http://www.example.com/login。
Google is not a good example because it uses GET for the form. For example, to search "jmeter" and press Feeling Lucky button, you can just send this URL,
http://www.google.com/search?hl=en&source=hp&q=jmeter&oq=&btnI=1
To do a real post, you need to find the form control field names from a trace or by looking at HTML source and just do something like showed here. The username/password are the field name to post. The action is http://www.example.com/login.
请注意,屏幕截图是错误的。方法为“GET”,应设置为“POST”,否则表单将无法正确提交。
Please note the screen shot is wrong. The method is a "GET" and it should be set to "POST", otherwise the form will not be submitted properly.
您想要对 Google 进行负载测试有什么原因吗?如果您只想有一个测试网站功能的脚本,请尝试使用 selenium: http://seleniumhq.org/。如果您实际上正在尝试对表单进行负载测试,则必须创建适当的请求。使用 Fiddler 这样的工具会有所帮助。
Is there a reason why you want to load test Google? If you just want to have a script that tests the functionality of a Website, try selenium: http://seleniumhq.org/. If you are actually trying to load test a form, you have to create the appropriate request. Using a tool like Fiddler can help.