我在使用动态定位器时遇到问题。这是我的 Xpath://*["@id=row"+${index}+"gridAlerts_AssignedToMe']/div[4]/a"
Name: Xpath
Condition: Equals
Value: id("row${index}gridAlerts_AssignedToMe")/div[4]/a
Detect By Property: Check box is checked.
这是我的脚本:
for (def index : (0..5)) {
def val = WebUI.getText(findTestObject('HomePage/AlertIdLocators', [('{index}') : index]))
}
我期望每次迭代时索引值都应该被 0 到 5 替换。
但这并没有发生。这是我的日志
11-30-2017 11:42:12 AM - [FAILED] - Test Cases/MyAlerts_LoopStatement FAILED because (of) Unable to get text of object 'Object Repository/HomePage/AlertIdLocators' (Root cause: com.kms.katalon.core.webui.exception.WebElementNotFoundException: Web element with id: 'Object Repository/HomePage/AlertIdLocators' located by 'By.xpath: id("row${index}gridAlerts_AssignedToMe")/div[4]/a' not found)