3 li
项目都不同。如果所有li
都是相同的,则表示重复,我们必须自动化此方案
我希望代码应该能够自动化查找重复li项目的过程
$runAction("org.getopentest.selenium.ReadElementText", {
locator: $data("locators/Profile").ClientsCSP,
$localData: {
description: "$output.text"
}
});
var str1 = $localData.abc;
$log(str1);
<div data-autoid="Clients" class="m-section ItemList__itemList___2dOxf m-body" style="" xpath="1">
<ul>
<li data-autoid="Clients_item_0" class="ItemList__label___1N5Nz">1-800 Contacts</li>
<li data-autoid="Clients_item_1" class="ItemList__label___1N5Nz">10 Advertising</li>
<li data-autoid="Clients_item_2" class="ItemList__label___1N5Nz">clients_23rd July</li>
</ul>
</div>
将li
项目存储在数组中,如果已重复找到log IT
最好的方法是使用getelements操作。
- description: Find all li elements
action: org.getopentest.selenium.GetElements
args:
locator: ... # This locator must match all li elements
- script: |
var listItems = $output.elements;
var itemsTextArray = listItems.map(function(li) {
return li.getText();
})
// Next, check itemsTextArray for duplicate items