[英]Looping through a table rows with comparisons using VUgen
I have a table I need to compare each of the values within to an existing parameter.我有一个表格,我需要将其中的每个值与现有参数进行比较。
I have this Xpath here: //*[@id="maincontent"]/messages/div/div[1]/div[1]/table/tbody/tr[1]/td[4]/div/span我在这里有这个 Xpath: //*[@id="maincontent"]/messages/div/div[1]/div[1]/table/tbody/tr[1]/td[4]/div/span
and would like to insert an increment variable from the loop to go through the /tr/ in the table only.并且想从循环中插入一个增量变量以仅通过表中的 /tr/ 。
Here is what i have so far:这是我到目前为止所拥有的:
var i;
var max = 10;
var xpathleft = `*[@id="maincontent"]/messages/div/div[1]/div[1]/table/tbody/tr[`;
var xpathright = `]/td[4]/div/span`;
for (i = 1; i < max, i++)
{
var currentXpath = string.concat(xpathleft, i, xpathright);
}
if (currentXpath.innerHTML == PartnerIDs)
{
lr_log_message("Match Found!");
}
This is currently sitting in an Evaluate Javascript step in TruClient/VUgen and is giving me Syntax Error: Unexpected Token )这当前位于 TruClient/VUgen 中的 Evaluate Javascript 步骤中,并给我语法错误:意外令牌)
The element here doesn't have any ID I can reference and looks like this: Partner ID此处的元素没有我可以引用的任何 ID,如下所示:合作伙伴 ID
and has been difficult to pull the needed Partner ID text within code.并且很难在代码中提取所需的合作伙伴 ID 文本。
Some of your JavaScript syntax is incorrect.您的某些 JavaScript 语法不正确。 Try this:尝试这个:
var i;
var max = 10;
var xpathleft = `*[@id="maincontent"]/messages/div/div[1]/div[1]/table/tbody/tr[`;
var xpathright = `]/td[4]/div/span`;
for (i = 1; i < max; i++){
var currentXpath = `${xpathleft}${i}${xpathright}`;
if (currentXpath.innerHTML == PartnerIDs) {
lr_log_message("Match Found!");
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.