如何利用 Selenium IDE 版本 3.13.0 遍历 Web table
How to Iterate across a web table utilizing Selenium IDE Version 3.13.0
我正在尝试使用新的 selenium ide 版本 3.13 自动执行回归测试。我想获得动态值而不是硬编码我的值。我有一个 table ,我想遍历它然后单击该元素。我一直在尝试一切,但没有任何效果我看到的是旧 selenium ide 中的示例,当时 "store eval" 是一个命令。请你 运行 一步步告诉我如何使用新的 selenium ide 实现这一目标。
我试过以下方法:
1.获取突出显示我要单击的所有行的元素
2. 现在我只需要知道如何在 table 中一次迭代一个元素。单击验证文本并继续下一个单击验证文本。
我的xpath:xpath=/html/body/div[4]/tracer-app/div[3]/div[4]/div[3]/ng-component/form/div/div[2]/div/questions-library/div/div[2]/div[1]/div
</a>
<!--template bindings={}--><a _ngcontent-csk-87="" class="list-group-item">
Accreditation Participation Requirements Question Library
</a><a _ngcontent-csk-87="" class="list-group-item">
Behavioral Health Care Inpatient
</a><a _ngcontent-csk-87="" class="list-group-item lib-selected">
Cardiac and Pulmonary Rehabilitation
</a><a _ngcontent-csk-87="" class="list-group-item">
Central Venous Catheter Audit
</a><a _ngcontent-csk-87="" class="list-group-item">
Chemotherapy Administration
</a><a _ngcontent-csk-87="" class="list-group-item">
CLABSI Prevention
</a><a _ngcontent-csk-87="" class="list-group-item">
Clinical Alarm Safety
</a><a _ngcontent-csk-87="" class="list-group-item">
Clinical Alarm Safety - Telemetry
</a><a _ngcontent-csk-87="" class="list-group-item">
Complaint and Grievance - Deemed Status
</a><a _ngcontent-csk-87="" class="list-group-item">
Contracted Services
预期结果:单击每个模板,验证文本并移至下一个元素,循环验证文本。
这是我的代码:
我使用 while 命令来创建一个循环,其中 i
作为迭代器。
为了在链接之间切换,我在 xpath 中放置了 i
迭代器 - //div[@class='main-navbar']/div/ul/li[${i}]/a
(图片上的第 6 行)
我有 exepexted_values
数组,其中包含我希望在页面上找到的选项卡名称。因此,在第 12 行中,我使用此数组中的值检查选项卡名称。然后我增加我的迭代器并重新开始。
我正在尝试使用新的 selenium ide 版本 3.13 自动执行回归测试。我想获得动态值而不是硬编码我的值。我有一个 table ,我想遍历它然后单击该元素。我一直在尝试一切,但没有任何效果我看到的是旧 selenium ide 中的示例,当时 "store eval" 是一个命令。请你 运行 一步步告诉我如何使用新的 selenium ide 实现这一目标。
我试过以下方法: 1.获取突出显示我要单击的所有行的元素 2. 现在我只需要知道如何在 table 中一次迭代一个元素。单击验证文本并继续下一个单击验证文本。
我的xpath:xpath=/html/body/div[4]/tracer-app/div[3]/div[4]/div[3]/ng-component/form/div/div[2]/div/questions-library/div/div[2]/div[1]/div
</a>
<!--template bindings={}--><a _ngcontent-csk-87="" class="list-group-item">
Accreditation Participation Requirements Question Library
</a><a _ngcontent-csk-87="" class="list-group-item">
Behavioral Health Care Inpatient
</a><a _ngcontent-csk-87="" class="list-group-item lib-selected">
Cardiac and Pulmonary Rehabilitation
</a><a _ngcontent-csk-87="" class="list-group-item">
Central Venous Catheter Audit
</a><a _ngcontent-csk-87="" class="list-group-item">
Chemotherapy Administration
</a><a _ngcontent-csk-87="" class="list-group-item">
CLABSI Prevention
</a><a _ngcontent-csk-87="" class="list-group-item">
Clinical Alarm Safety
</a><a _ngcontent-csk-87="" class="list-group-item">
Clinical Alarm Safety - Telemetry
</a><a _ngcontent-csk-87="" class="list-group-item">
Complaint and Grievance - Deemed Status
</a><a _ngcontent-csk-87="" class="list-group-item">
Contracted Services
预期结果:单击每个模板,验证文本并移至下一个元素,循环验证文本。
这是我的代码:i
作为迭代器。
为了在链接之间切换,我在 xpath 中放置了 i
迭代器 - //div[@class='main-navbar']/div/ul/li[${i}]/a
(图片上的第 6 行)
我有 exepexted_values
数组,其中包含我希望在页面上找到的选项卡名称。因此,在第 12 行中,我使用此数组中的值检查选项卡名称。然后我增加我的迭代器并重新开始。