How can i get selenium to click on the next button from the HTML code below?
<span class="action-btn" data-bind="visible: viewModel.page() < viewModel.pages(), click: viewModel.changePage(+1);">></span>
elm = driver.find_element_by_class_name('action-btn')
Looking at your screenshot it seems the
action-btn you want to click is the last one in
And, if you have only one
div element with class
pager, you could select all
action-btn inside it and get the last one:
elem = driver.find_element_by_css_selector("div.pager span.action-btn:last-of-type");
Here are more details about
:last-of-typeCSS pseudo-class represents the last sibling with the given element name in the list of children of its parent element.