如何使用带有ajax请求的jmeter

时间:2021-10-11 13:27:38

How to use JMeter with ajax request?

如何将JMeter与ajax请求一起使用?

I have a button with is clicked and by using fiddler I can find the session id which is being sent to the server.

我点击了一个按钮,通过使用fiddler我可以找到发送到服务器的会话ID。

What should I do next using the JMeter in order to handle this.

接下来我应该怎么做才能使用JMeter来处理这个问题。

EDIT:

编辑:

Let's say I have in my hand the header which call the request. The JSESSIONID AJAXREQUEST and so on where should I put it ?... I putted it in http header manager name and value.

假设我手中有一个调用请求的标题。 JSESSIONID AJAXREQUEST等我应该把它放在哪里?...我把它放在http头管理器名称和值中。

1 个解决方案

#1


5  

Jmeter will not execute Javascript embedded in your web page. However AJAX request is also a HTTP request that Jmeter will be able to run as a separate HTTP request and upon getting the response you can have post processors (using XPATH or REGEX) to extract the session id in a Jmeter variable.

Jmeter不会执行您网页中嵌入的Javascript。但是,AJAX请求也是一个HTTP请求,Jmeter将能够作为单独的HTTP请求运行,并且在获得响应后,您可以使用后处理器(使用XPATH或REGEX)来提取Jmeter变量中的会话ID。

Alternatively you can record the Jmeter scripts using Jmeter proxy and then all the HTTP requests will be recorded for you and you will just need to attach a post processor manually.

或者,您可以使用Jmeter代理记录Jmeter脚本,然后将为您记录所有HTTP请求,您只需手动附加后处理器。

#1


5  

Jmeter will not execute Javascript embedded in your web page. However AJAX request is also a HTTP request that Jmeter will be able to run as a separate HTTP request and upon getting the response you can have post processors (using XPATH or REGEX) to extract the session id in a Jmeter variable.

Jmeter不会执行您网页中嵌入的Javascript。但是,AJAX请求也是一个HTTP请求,Jmeter将能够作为单独的HTTP请求运行,并且在获得响应后,您可以使用后处理器(使用XPATH或REGEX)来提取Jmeter变量中的会话ID。

Alternatively you can record the Jmeter scripts using Jmeter proxy and then all the HTTP requests will be recorded for you and you will just need to attach a post processor manually.

或者,您可以使用Jmeter代理记录Jmeter脚本,然后将为您记录所有HTTP请求,您只需手动附加后处理器。