在 Selenium WebDriver 中查找分页按钮的数量 [英] Finding the number of pagination buttons in 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()
虽然有五列/ Is returning 0 though there are five columns/ 您正在按 Id 搜索,但您给出了 xpath 表达式.试试 You are searching by Id, but you gave xpath expression. Try 这篇关于在 Selenium WebDriver 中查找分页按钮的数量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! 标签,但返回 0.
<td>
tags.推荐答案
driver.findElements(By.xpath("//*[@id='ContentPlaceHolder1_gvChannelList']/tbody/tr[17]/td/table/tbody/tr/td")).size()
登录
关闭