在 Selenium WebDriver 中查找分页按钮的数量 [英] Finding the number of pagination buttons in Selenium WebDriver

查看:101
本文介绍了在 Selenium WebDriver 中查找分页按钮的数量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

分页本身就是表ContentPlaceHolder1_gvChannelList"的最后一行.我想计算分页表中的页数/列数.

Pagination is itself a last row of table "ContentPlaceHolder1_gvChannelList". I want to count the number of pages/number of columns in pagination table.

driver.findElements(By.id("//*[@id='ContentPlaceHolder1_gvChannelList']/tbody/tr[17]/td/table/tbody/tr/td")).size()

虽然有五列/ 标签,但返回 0.

Is returning 0 though there are five columns/<td> tags.

html 表格元素层次结构

推荐答案

您正在按 Id 搜索,但您给出了 xpath 表达式.试试

You are searching by Id, but you gave xpath expression. Try

driver.findElements(By.xpath("//*[@id='ContentPlaceHolder1_gvChannelList']/tbody/tr[17]/td/table/tbody/tr/td")).size()

这篇关于在 Selenium WebDriver 中查找分页按钮的数量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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