Zack
Zack

Reputation: 2208

How to go to second page or next page in the search results using XPATH

Well...I think I still haven't figured out how xpath works. I am trying to select the below element so that I can click on the second page. But what I am trying does not work. What is wrong here? I am selecting the a tag and then trying to find the one which contains ref whose value is next.

element = driver.findElement(By.xpath("//a[contains(@ref,'next')]"));

enter image description here

Upvotes: 1

Views: 772

Answers (1)

Saifur
Saifur

Reputation: 16201

I probably see a typo there. The attribute you are trying to use is rel which has value next

So the correct xpath will be

//a[contains(@rel,'next')]

Upvotes: 3

Related Questions