如何使用Selenium Python WebDriver从Web应用程序计算表中的行数 [英] How to count no of rows in table from web application using selenium python webdriver

查看:97
本文介绍了如何使用Selenium Python WebDriver从Web应用程序计算表中的行数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用Selenium python Web驱动程序从Web应用程序计算表中的行.在这里,我们可以从Web应用程序中检索表中的所有数据,但无法计算行数和列数,请告诉我如何执行此操作.

How to count the rows in the table from web application by using selenium python web driver. Here we can retrieve all data in the table from web application but couldn't count the rows and columns, please give me idea of how to do this.

推荐答案

尝试类似的事情

int rowCount=driver.findElements(By.xpath("//table[@id='DataTable']/tbody/tr")).size();

int columnCount=driver.findElements(By.xpath("//table[@id='DataTable']/tbody/tr/td")).size();

仅供参考:这是Java中的实现.

FYI : This is the implementation in java.

这篇关于如何使用Selenium Python WebDriver从Web应用程序计算表中的行数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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