python+selenium 获取table列表中所有数据条数

时间:2020-07-28 17:25:27   收藏:0   阅读:137

# 定位到table,并获得table中所有得tr元素

menu_table = self.driver.find_element_by_xpath("//div[@class=‘datagrid-view1‘]/div[2]/div/table")

rows = menu_table.find_elements_by_tag_name(‘tr‘)

# python 得len()函数返回对象(字符、列表、元组)得长度或者元素得个数

before_add_numbers = len(rows)
print(before_add_numbers)

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!