Repeat keywords for each page of pagination

Hello,

I have a complex issue and I need your help !
On one of my test, I make 3 verifications on my first results page.
Each verification is in Gherkin language and corresponding to keywords (here is an extract) :

  • Then the page only displays the SALE transaction type in main research

  • And the page only displays the APPARTMENT type in main research

  • And the page only displays the MILLAU locality in main research

Those verifications work on my first result page but when the user click on the “Next” button, the second page of results appear… and I must make the same verification on this page (and the following…)

Is it possible only with Robotframework’s keywords or should I use the Python code to write it?
I can duplicate the verificaion on the next page but I would like to loop it for each pagewhen the user click on “Next”.

Thanks for all !

Hello John,
Is this a web application that you are working with? Are you already using SeleniumLibrary?

Hello.

I’m working with a website and SeleniumLibrary is one of library I use.

You should have some keyword to click “Next page” in the pagination area, right? Why don’t you call those keywords inside it? e.g.

User clicks next page
Click next page
the page only displays the SALE transaction type in main research
the page only displays the APPARTMENT type in main research
the page only displays the MILLAU locality in main research

I agree with @donzoolo’s advice. I don’t think there’s a Keyword in Robot Framework or in Selenium Library that will magically do this for you.

Also, is this a Test that you are automating or a Task? Meaning, will you know beforehand whether there are 3 pages in the grid or maybe 10 grid pages? Or perhaps you can do a “show all results” on the grid so that there are no pages beyond 1 page?

I think a screen shot of your page will help us help you.

If this is a test you are automating, then the ideal way to handle this would be to use an account/username or an environment where you can control the data that is there.

Or maybe do a WHILE loop where it keep clicking on ‘Next Page’ while it is enabled…something along those lines. Such complicated Keyword might be best handled in Python vs. Robot Framework.

But again, you might be trying to get your automation to do more than it should be doing…especially if this is a test you are trying to automate.

@donzoolo I can do what you explain, but if there are several pages to verify, i should repeat the “User clicks next page” each time, no?

@hobet : Indeed, I would use the “While” loop to say "While the “Next page” button is active, execute the following keywords

  • the page only displays the SALE transaction type in main research
  • the page only displays the APPARTMENT type in main research
  • the page only displays the MILLAU locality in main research