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

# 定位到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)

 

posted @ 2020-07-28 15:20  博小园  阅读(1818)  评论(0编辑  收藏  举报
回到顶部