I ran into a problem when I was searching for a button to select. When I try to search for it using
if (driver.getPageSource().contains("pager")) {
WebElement pageSelector = driver.findElement(By.className("pager__item pager__item--last"));
System.out.println("hello");
pageSelector.click();
}
However, it gives me the error - Compound class names not permitted. I read about hte issue, and it seems that using a csselector would be the way to solve it instead of using By.className. However, I cannot get the csSelector to work. This is the piece of html that contains the element I am searching for.
<div class="view-content">
<div class="item-list">
</div>
<h2 class="element-invisible">Pages</h2>
<ul class="pager">
<li class="pager__item pager__item--current">1</li>
<li class="pager__item">
<li class="pager__item">
<li class="pager__item">
<li class="pager__item">
<li class="pager__item">
<li class="pager__item pager__item--next">
<li class="pager__item pager__item--last">
<a href="/blogs?date_filter[value]&field_term_programs_offices_tid=All&page=5" title="Go to last page">last ยป</a>
How can I select the "pager__item pager__item--last" item?