我试图让JMeter在以下XPath中读取预先填充的表单输入值:/html/body/div[1]/div[3]/div[2]/form/table/tbody/tr[2]/td/div[1]/input/@value
因为我只得到ERROR,所以我调查并启用了Tidy(宽容解析器)以及详细程度(不安静;报告错误),我发现了这个:
ERROR - jmeter.util.XPathUtil: TidyException: line 65 column 9 - Error: <nav> is not recognized!
line 95 column 11 - Error: <nav> is not recognized!
InputStream: Doctype given is ""
InputStream: Document content looks like HTML 4.01 Transitional
85 warnings, 2 errors were found!
This document has errors that must be fixed before
using HTML Tidy to generate a tidied up version.
由于我们是在2017年,该文档当然是用HTML5编写的,而<nav>
是一个完全有效的标记。然而,Tidy没有认识到它。我使用JMeter 3.1 r1770033运行最新的Arch Linux系统。
如何在JMeter中为HTML5网站使用XPath?