12-09-24 02:16 AM - edited 12-09-24 02:17 AM
My Scenario: I am working on a website with a page navigation system in Chrome that has "Previous" and "Next" buttons, which are always available. When I click the "Next" button on the last page, it takes me back to the first page, and the process continues as normal. Page numbers can be skipped (for example, there may be pages 1, 2, 3, but then it jumps to 6, 7, etc.). Some pages are missing, meaning the navigation doesn’t always show consecutive numbers. I want to ensure that each page is only visited once. I need a stopping criterion so that the process ends once I’ve gone through all the pages.
The Problem: Since the "Next" button is always available and when I reach the last page, it takes me back to the first page, I need a way to detect when I have already visited all the pages. Some pages do not exist (for example, pages like 4 or 5 might be missing), so the bot cannot assume that pages are in a sequential order.
Do you have any idea how i can create a stopping criterion and how can I account for the fact that not all pages exist?
12-09-24 04:31 AM
HI sauli,
I would probably check few things, It may not solve it but just thought to share some ideas
1) CHeck the URL and see any difference when you navigate the page from one to another
2) Whether you are able to capture the list of the page numbers not only the ones it is visible and I think you might need to right click in the app in the emptry space> inspect and then check how the page numbers and Previous and next button was built in the application and see whether you can build the logic based out of it.
12-09-24 04:48 AM
Usually in page navigation like that for lists of items, there is a change in the navigation controls when you reach the end. Could you share a screenshot of this if you want our suggestions on it? Personally I would first go straight into the HTML and do the page navigation manually and see if something about the elements change in some way that would be something to monitor to determine when you've reached the last page. But in any case, you said that some pages are missing which makes sense. But is it possible to use some selector such as xpath or css selector that generically can find those page navigation numbers and use it to find the last one displayed on the page? Would that number then tell you how many total pages there are?
I'm picturing something like this:
Previous 1 2 3 ... 55 56 57 Next
In that case, 57 would be the last page and you'd be able to track how many times you click next or monitor the 57 element for some change to indicate it is currently the active page. Hmm, actually a lot of times the current page's element is not linkified so that it isn't clickable because you're already on that page.
I dunno. I'm with Harish on not knowing what to suggest for you. We'd need to see the page, at least a screenshot but a GIF or video would be even better.