0

I am working in Selenium and now I am automating a search page. This is scenario. There list page and pagination, If there a module and contain the list of each entires. 1 to 5 pages are there. Each list page has a search field. If there two name field like name and addrees. When I enter first charater of the name and then click on search. then display that paricular names will list. And also it will display from the 1 to 5 page contain names.

In manually I will do like check the cases:

  1. Search the first character of the name
  2. Search the full character of that name
  3. search the first, second, third, fourth... upto last character

I want to know how to automate this scenario... there is a pagination.

Whether I search for character like "T". It may be in the 3 rd page. And it will display on the list. So how to automate the above scenario?

1

The only issue here is performance versus maintainability:

1 - If you want better performance, you would setup your database so that you will know exactly where your result will appear. In this case, you would perform the search and go directly to the page where the result is. If the SUT changes in a way that your result would end up in another page, you would have to update your test.

2 - If you want protection against changes, you can perform a dumb validation in each page after searching, checking if your result in present in some page.

1

I will present you the logic of one possible solution I have implemented. From what I can deduct, it's the kind of thing you want. The test will work for any search values you'll pass into it.

Test method steps:

  • Go to search page
  • Enter search criteria and start search
  • Save all result rows in a list (go through each page)
  • Assert whatever you want to test
    • e.g. a specific value is present in the list
    • e.g. all results in the list contain the search criteria

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy