Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

348
Views
How to validate pagination counter text changes with each page?

A very much beginner to JS and coding in general, so my apologies if this is too elementary of a question to ask.

Goal: On a webpage, I am going through a page that has a maximum of five pages total. There is a pagination counter at the bottom that reads "Page x of 5", with the "x" displaying the page the user is on. I simply have to navigate to the "next" page and verify that the pagination text updates to the correct counter text (Page x of 5).

The code is as follows:

let paginationValues = function(){
                var nextPageBtn = false
            do {
                    nextBtnPagination = driver.exists('ul.pagination-skipToNext')
                    if (nextBtnPagination) {
                        //do stuff
                } 
                    } while (nextPageBtn) 

The xpath points to a text value with the pagination counter text using Selenium WebDriver.

So basically I have to click the "next page" button if it exists, which I have done. However, I need to validate that the pagination text responds accordingly by making sure the user is navigated to "Page 2 of 5", "Page 3 of 5" and so on.

Please advise.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

If all you need is to display the page number that user navigated to, then why don't you just use global variable and increment/decrement its value based on user navigation actions. and display its value, I think this would be much better then trying with selenium webdriver which extract the value through DOM.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!