0

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/<td> tags.

html table element hierarchy

1 Answer 1

1

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()
Sign up to request clarification or add additional context in comments.

1 Comment

Corrected the expression. Working fine. Thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.