- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在尝试迭代 HTML 表以从中获取值,但没有得到所需的结果。这是 HTML 代码:
<div class="o_sale_order table-responsive">
<table class="o_list_view table table-sm table-hover table-striped o_list_view_ungrouped">
<thead>
<tr>
<th width="1" class="o_list_record_selector">
<div class="custom-control custom-checkbox">
<input type="checkbox" id="checkbox-868" class="custom-control-input">
<label for="checkbox-868" class="custom-control-label"></label></div>
</th>
<th class="o_column_sortable" data-original-title="" title="">Quotation Number</th>
<th class="o_column_sortable" data-original-title="" title="">Quotation Date</th>
<th class="o_column_sortable" data-original-title="" title="">Customer</th>
<th class="o_column_sortable" data-original-title="" title="">Salesperson</th>
<th class="o_column_sortable" style="text-align: right;" data-original-title="" title="">Total</th>
<th class="o_column_sortable" data-original-title="" title="">Status</th>
</tr>
</thead>
<tbody class="ui-sortable">
<tr class="o_data_row">
<td width="1" class="o_list_record_selector">
<div class="custom-control custom-checkbox">
<input type="checkbox" id="checkbox-869" class="custom-control-input">
<label for="checkbox-869" class="custom-control-label"></label></div>
</td>
<td class="o_data_cell o_readonly_modifier o_required_modifier">SO107</td>
<td class="o_data_cell o_required_modifier">03/04/2019 17:40:46</td>
<td class="o_data_cell o_required_modifier">AA</td>
<td class="o_data_cell">Administrator</td>
<td class="o_data_cell o_list_number o_monetary_cell o_readonly_modifier">
<span class="o_field_monetary o_field_number o_field_widget o_readonly_modifier" name="amount_total">305.00 €</span></td>
<td class="o_data_cell o_readonly_modifier">Quotation Sent</td>
</tr>
<tr class="o_data_row">
<td width="1" class="o_list_record_selector">
<div class="custom-control custom-checkbox">
<input type="checkbox" id="checkbox-870" class="custom-control-input">
<label for="checkbox-870" class="custom-control-label"></label></div>
</td>
<td class="o_data_cell o_required_modifier">SO055</td>
<td class="o_data_cell o_required_modifier">03/01/2019 20:24:35</td>
<td class="o_data_cell o_required_modifier">AA</td>
<td class="o_data_cell">Administrator</td>
<td class="o_data_cell o_list_number o_monetary_cell o_readonly_modifier">
<span class="o_field_monetary o_field_number o_field_widget o_readonly_modifier" name="amount_total">2.44 €</span></td>
<td class="o_data_cell o_readonly_modifier">Quotation</td>
</tr>
<tr class="o_data_row">
<td width="1" class="o_list_record_selector">
<div class="custom-control custom-checkbox"><input type="checkbox" id="checkbox-871" class="custom-control-input">
<label for="checkbox-871" class="custom-control-label"></label></div>
</td>
<td class="o_data_cell o_required_modifier">SO039</td>
<td class="o_data_cell o_required_modifier">03/01/2019 12:16:08</td>
<td class="o_data_cell o_required_modifier">AA</td>
<td class="o_data_cell">Administrator</td>
<td class="o_data_cell o_list_number o_monetary_cell o_readonly_modifier">
<span class="o_field_monetary o_field_number o_field_widget o_readonly_modifier" name="amount_total">2.44 €</span></td>
<td class="o_data_cell o_readonly_modifier">Quotation</td>
</tr>
<tr class="o_data_row">
<td width="1" class="o_list_record_selector">
<div class="custom-control custom-checkbox">
<input type="checkbox" id="checkbox-872" class="custom-control-input">
<label for="checkbox-872" class="custom-control-label"></label></div>
</td>
<td class="o_data_cell o_required_modifier">SO025</td>
<td class="o_data_cell o_required_modifier">02/28/2019 19:50:59</td>
<td class="o_data_cell o_required_modifier">BB</td>
<td class="o_data_cell">Administrator</td>
<td class="o_data_cell o_list_number o_monetary_cell o_readonly_modifier">
<span class="o_field_monetary o_field_number o_field_widget o_readonly_modifier" name="amount_total">2.44 €</span></td>
<td class="o_data_cell o_readonly_modifier">Quotation</td>
</tr>
</tbody>
<tfoot>
<tr>
<td></td>
<td class="name"></td>
<td class="date_order"></td>
<td class="partner_id"></td>
<td class="user_id"></td>
<td class="amount_total o_list_number" title="Total Tax Included">312.32</td>
<td class="state"></td>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
</main>
</div>
我需要从每一行获取以“SO”开头的值,如下所示:
<td class="o_data_cell o_required_modifier">SO055</td>
我尝试过:
List<String> list = new ArrayList<>();
driver.findElement(By.xpath("//*[@class = 'o_dropdown_toggler_btn btn btn-secondary dropdown-toggle' and (contains(text(), 'Filters') or contains(., 'Filters'))]")).click();
driver.findElement(By.xpath("(//a[contains(text(),'Quotations')])[2]")).click();
driver.findElement(By.xpath("//*[@class = 'o_dropdown_toggler_btn btn btn-secondary dropdown-toggle' and (contains(text(), 'Filters') or contains(., 'Filters'))]")).click();
List<WebElement> rows = driver.findElements(By.xpath("//table[@class='o_list_view table table-sm table-hover table-striped o_list_view_ungrouped']//tr[not(th)]"));
Iterator<WebElement> iter = rows.iterator();
while(iter.hasNext()) {
WebElement tr = iter.next();
WebElement td = tr.findElement(By.xpath("./td[(@class='o_data_cell o_readonly_modifier o_required_modifier')]"));
listaPreventiviFatturabili.add(td.getText());
}
但它不起作用。
这是相关网页的屏幕截图:
你能帮我吗?
另一个问题:选择“引用”过滤器后如何等待页面加载?
最佳答案
试试这个 xpath。它将返回包含 SO 值的所有单元格
By.xpath("//table//td[contains(text(),'SO')]");
List<WebElement> rows = driver.findElements(By.xpath("//table//td[contains(text(),'SO')]"));
关于java - 使用 Selenium/Katalon 迭代 html 表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55022951/
我仔细阅读了说明 here ,但仍然在记录网络上按下时(当然是在 chrome 上)我仍然使用常规浏览器而不是隐身模式。也许有办法在 testCase 脚本中更改它? 如何使用隐身模式进行录制? 这是
在我们的 Katalon Studio项目我们有一个测试用例。 我们喜欢该测试用例在运行测试套件时接受来自命令行的参数。 例如,我们喜欢用 parameter=A 运行相同的测试用例一次。另一个是 p
我正在使用 Katalon Studio 通过 Web 服务调用获取响应对象,现在我想检查给定的用户值是否存在于响应对象中。我怎样才能做到这一点?请帮忙。代码:: ResponseObject get
我在Katalon中保存了一个TestObject,它有一个ul标签。我希望用它来编写一个涉及其 li 元素的测试用例,但不知道如何在 Katalon 中选择它们,更不用说循环遍历它们了。在 Sele
我试图捕获SVG对象,但Katalon程序无法做到这一点。我一直在寻找互联网上的操作方法,但已经过去了数小时,但我仍然一无所获。您能为我最后一个对象`Deale:Przypisania的xpath写信
我可以知道如何从 Katalon Studio 中的 excel 表中读取数据,以便从文件中读取 API 端点以检查其输出吗? 如何在 java 中编写代码来运行 URL 并验证来自 API 端点的响
我需要确保我们的软件能够在市面上所有类型的移动 Android 和 iOS 设备上顺畅运行。 Katalon Studio 是否能够在不同类型的设备上运行测试而无需实际拥有这些设备? 最佳答案 是的,
我正在尝试构建一个测试层次结构,在其中执行其他测试套件,以便新的测试套件从上一个套件停止的地方开始。有什么方法可以在我的测试套件设置中运行测试套件执行吗? @SetUp(skipped = false
我有一个 powershell 脚本,它执行以下但很难找到测试套件路径 docker run -t -v ${pwd}:/katalon/katalon/source katalonstudio/ka
在 Katalon Studio 中可以同时运行多少个测试? 推荐的最低配置需要 1GHz CPU 和 2GB RAM。当我在我的 16GB 计算机上运行测试时,同时运行 5-6 个较短的测试(大约
我想知道日志记录的最佳实践是什么,因为我有一个通用测试用例,我从中调用其他特定测试用例,我不喜欢使用 KeywordLogger 或 KeywordUtil 每个类中的对象。我应该只使用 Keywor
我已经使用Groovy在Katalon Studio中创建了一个自定义关键字函数。 下面是我的功能 def referenceTabRecordSelection(String expectedRef
我有 OpenJDK8 和 OpenJDK13。但我无法启动 Katalon Studio。这是日志: 我听说Katalon studio需要OpenJDK8。有没有办法将 katalon studi
我想在报告生成后执行脚本,目前我只能使用监听器类,但这发生在报告创建之前。下面是监听器类的示例。 @AfterTestSuite def sampleAfterTestSuite(TestSu
我正在用 Katalon 编写脚本,但现在卡住了。当使用 Katalon 的 Chrome 附加组件时,我可以在我现有的浏览器窗口中启动自动化进程时按下播放键。在这个浏览器中,我已经登录到我的目标 U
我在 .net visual studio 中有一个名为 slowcheetah 的东西,它允许我为环境 URL 存储多个 app.configs,并根据我针对我的 selenium 测试运行的测试环
我正在尝试远程运行 Katalon 生成的 CLI 命令。但是我收到一个错误。 命令 - winrs -r: D:\Katalon_Studio_Windows_64-5.4.2\katalon -n
我想使用 Katalon 测试登录,但我使用的是 CAPTCHA。 CAPTCHA 中的数字始终更改。 Katalon 可以在运行测试时读取它吗? 最佳答案 我认为你做不到。 CAPTCHA 的意思是
我想知道是否有任何方法可以在脚本模式下减小字体大小,因为在笔记本电脑上工作时,较大的文本只能看到几行。需要大量滚动,这不是最佳体验。 最佳答案 Window -> Katalon Studio Pre
目前,Katalon studio 中的记录功能使用所有可能性来识别元素(即标签、id、名称、类、文本和完整的 XPath)。由于某些原因,完整的 XPath 在实际测试中总是无法识别元素,而元素上的
我是一名优秀的程序员,十分优秀!