I'm just starting with casper and I'd like to retrieve the current page number which is stored in a list. I assume this can be done using both class and the aria-selected which must be true to indicate the current page.
I would appreciate if someone can point out how to do this programmatically. Here's what I've currently got so far:
casper.then(function () {
var el = document.querySelector('li[class="mod-ui-pagination__number"]'); // li[class="navigation-link-disabled"]
this.echo(el);
});
HTML:
<ul class="mod-ui-pagination">
<li class="mod-ui-pagination__arrows" aria-disabled="false"><i class="o-ft-icons-icon o-ft-icons-icon--arrow-left"></i></li>
<li class="mod-ui-pagination__number" aria-selected="false" data-mod-pagination-num="1">1</li>
<li class="mod-ui-pagination__number" aria-selected="true" data-mod-pagination-num="2">2</li>
<li class="mod-ui-pagination__number" aria-selected="false" data-mod-pagination-num="3">3</li>
<li class="mod-ui-pagination__ellipsis"><i class="o-ft-icons-icon o-ft-icons-icon--more"></i></li>
<li class="mod-ui-pagination__number" aria-selected="false" data-mod-pagination-num="739">739</li>
<li class="mod-ui-pagination__number" aria-selected="false" data-mod-pagination-num="740">740</li>
<li class="mod-ui-pagination__number" aria-selected="false" data-mod-pagination-num="741">741</li>
<li class="mod-ui-pagination__arrows" aria-disabled="false"><i class="o-ft-icons-icon o-ft-icons-icon--arrow-right"></i></li>
</ul>
via Charles Fried
No comments:
Post a Comment