硒动态表 [英] selenium dynamic growing table

查看:68
本文介绍了硒动态表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用硒处理动态生长台时遇到一些麻烦. 概括起来,在我的Web应用程序上,我有一个包含30个项目的表格,但它仅显示前20个项目,我们必须向下滚动才能显示其余项目. 而且我不知道如何在不向下滚动的情况下获得第26个(例如)物品.

I have some troubles to handle dynamic growing table with selenium. To sum up quickly, on my web app I have a table with 30 items but it only displays the twenty first items and we have to scroll down to display the rest. And I don't know how to get the 26th (for example) items without scrolling down.

我的HTML:

<table id="tableID" tabindex="0" aria-multiselectable="true" role="grid">
    <thead>
    <tbody id="tableID-tblBody">
        <tr id="item1" role="row" tabindex="-1">
        <tr id="item2" role="row" tabindex="-1">
        [... 17 more]
        <tr id="item20" role="row" tabindex="-1">
    </tbody>
</table>

滚动后:

<table id="tableID" tabindex="0" aria-multiselectable="true" role="grid">
    <thead>
    <tbody id="tableID-tblBody">
        <tr id="item1" role="row" tabindex="-1">
        <tr id="item2" role="row" tabindex="-1">
        [... 27 more]
        <tr id="item30" role="row" tabindex="-1">
    </tbody>
</table>

如果有人可以帮助我,那就太好了^^
谢谢!

If someone could help me it would be great ^^
Thanks!

推荐答案

我会

其中element:

WebElement element = driver.findElements(By.xpath("//table[@id = 'tableID']//tr[last()]")).

这篇关于硒动态表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆