简体   繁体   English

Jmeter给xpath带来了问题

[英]Jmeter giving problems with xpath

I have been attempting to use JMeter's XPath extractor for a while now, and have been unable extract anything at all. 我已经尝试使用JMeter的XPath提取器已有一段时间了,并且根本无法提取任何东西。

I have been using Firebug to give me the XPath of a link by right-clicking on a->Copy XPath which gives me the following /html/body/div[4]/div/div[4]/div/div[2]/div/div[3]/div/a . 我一直在使用Firebug ,通过右键单击a->Copy XPath为我提供链接的a->Copy XPath ,它为我提供了以下/html/body/div[4]/div/div[4]/div/div[2]/div/div[3]/div/a

I have been testing this ( /html/body/div[4]/div/div[4]/div/div[2]/div/div[3]/div/a/@href ) in Firefox's XPath Checker which successfully returns all the links on the page. 我已经在Firefox的XPath Checker对此进行了测试( /html/body/div[4]/div/div[4]/div/div[2]/div/div[3]/div/a/@href )返回页面上的所有链接。

I am fairly certain that my problem is with JMeter, and not my XPath syntax etc. 我相当确定我的问题出在JMeter,而不是我的XPath语法等。
Has anyone else had similar problems? 还有其他人有类似的问题吗?

1. * First of all: * since you are using XPath Extractor to parse HTML (not XML) response ensure that Use Tidy (tolerant parser) option is CHECKED (in XPath Extractor's control panel ). 1. * 首先: *由于您正在使用XPath Extractor来解析HTML(非XML)响应,因此确保已选中Use Tidy(宽容分析器)选项(在XPath Extractor的控制面板中 )。

2. XPath query like your above ( /html/body/div[4]/div/div[4]/div/div[2]/div/div[3]/div/a/@href ) looks not very accurate. 2.像您上面的XPath查询( /html/body/div[4]/div/div[4]/div/div[2]/div/div[3]/div/a/@href )看起来不太准确。 Suppose you can try to use something like the following: 假设您可以尝试使用以下内容:

//a[@id="..."][@name="..."][text()="..."]/@href

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM