我在JMeter中有一个爬虫测试(爬虫)的问题,我在java中也有本机代码,它不能工作,因为我需要在POST中发送一个名为javax.faces.ViewState的参数
我只需要绕过这个参数,然后我将我的代码留在Java中,根据您的意见,爬虫(爬虫)会更可行。
在此处输入图像描述image error in JMeter
public static void main(String[] args) {
try {
Connection.Response loginForm = Jsoup.connect("http://appware-sst.com/elegancia-ejecutiva")
.method(Connection.Method.POST)
.userAgent("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.152 Safari/537.36")
.execute();
Document document = Jsoup.connect("http://appware-sst.com/elegancia-ejecutiva/php/inicio_admin.php")
.data("user", "admin")
.data("password", "12345")
.cookies(loginForm.cookies())
.post();
System.out.println(document);
} catch (Exception e) {
System.out.println(e);
}
}发布于 2017-04-06 12:11:00
看看你的正则表达式,我认为你不需要这个!。
此外,根据您的服务器响应,您可能会得到多行,在name和value之间有其他标记,等等,所以我建议使用XPath Extractor来获取值,相关的配置如下:
查询引用名称:任何有意义的东西,例如viewState
//input[@name='javax.faces.ViewState']/@valueJMeter应该更适合,因为它支持cookies,headers,cache,reporting。此外,您还可以使用HTTP(S) Test Script Recorder快速构建测试框架。
您可能还会发现How to Spider a Site with JMeter - A Tutorial很有用,因为您可以仅使用HTML Link Parser测试元素构建爬虫程序。
https://stackoverflow.com/questions/43243050
复制相似问题