JMeter 和 JavaScript [英] JMeter and JavaScript

查看:20
本文介绍了JMeter 和 JavaScript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在 JMeter 中发出 HTTP 请求时,我得到响应数据,例如此页面使用 JavaScript 并且需要启用 JavaScript 的浏览器".如何解决这个问题.

When I make HTTP Request in JMeter I get Response data like "This page uses JavaScript and requires a JavaScript enabled browser." How is it possible to fix this problem.

推荐答案

JMeter 不是浏览器,不会解释下载页面中的 JavaScript.

JMeter is not a browser, and does not interpret the JavaScript in downloaded pages.

来自 JMeter wiki:

JMeter 不处理嵌入在 HTML 页面中的 Javascript 或小程序.

JMeter does not process Javascript or applets embedded in HTML pages.

JMeter 可以下载相关资源(部分内嵌资源如果设置了正确的选项,将自动下载),但它不处理 HTML 和执行任何 Javascript 函数.

JMeter can download the relevant resources (some embedded resources are downloaded automatically if the correct options are set), but it does not process the HTML and execute any Javascript functions.

如果页面使用 Javascript 来构建 URL 或提交表单,您可以使用代理录音工具来创建必要的采样器.如果这是不可能的,则可能需要手动检查代码需要确定 Javascript 正在做什么.

If the page uses Javascript to build up a URL or submit a form, you can use the Proxy Recording facility to create the necessary sampler. If this is not possible, then manual inspection of the code may be needed to determine what the Javascript is doing.

根据您在做什么,您可以使用 Selenium IDE 为 Firefox 创建一个执行测试.测试将在您的浏览器中运行,因此 JavaScript 也将运行.但请注意,我从未使用 Selenium 作为 JMeter 的替代品,也不了解这两种工具的共同特性.

Depending on what you are doing, you could create an execution test using Selenium IDE for Firefox. The test will run in your browser so the JavaScript will also run. Note though that I never used Selenium as a substitute for JMeter and don't know about common features to both the tools.

这篇关于JMeter 和 JavaScript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆