Reputation: 198
I'd like to click on the following link but it's not working:
<ul class="pagination pagination-large">
<li style="display:inline;">
<a name="Next" href="jamm/flavours/page=2" class="next">
<span class="icon-navigate_next"></span>
</a>
</li>
</ul>
My code
items = browser.find_elements_by_xpath("//ul[@class = 'pagination pagination-large']//li[@style ='display:inline;']")
print items
for k in items:
print k
k.click()
print("clicked")
k.send_keys(webdriver.common.keys.Keys.SPACE)
Upvotes: 0
Views: 71
Reputation: 15209
I think the problem is the xpath
you are using is not finding the element you need, in fact, it targets the list element, not the anchor.
Maybe you can try to identify the link by using the css class next
instead:
items = browser.find_elements_by_class_name('next')
for item in items:
item.click()
If it works now, you can either just use that if you don't have any other elements using it or you can fix your xpath
.
Upvotes: 1