Issue
I'm trying to select how many total pages of results using driver.find_elements_by_partial_link_text('Last Page')
The last page button has this:
<a class="btn pageJump btn-inverse hidden-xs"
data-track="Search - Pagination - Bottom - Last Link"
data-page="111">Last<span class="hidden-xs hidden-sm hidden-md">
So I'm trying to select the '111' in this case, telling me there are 111 pages of results. I can find the button using link/text, but the 111 is not shown anywhere in the properties.
Is there a way to select the data-page=111 directly?
Solution
I was able to solve this using the following code:
driver.find_element_by_xpath('.//a[@data-track="Search - Pagination - Bottom - Last Link"]').get_attribute('data-page')
This produces '111' which I can easily convert to an int for my for loop.
Answered By - Robot Marvin 42
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.