1

enter image description here

Please focus on the area highlighted in red.

As shown, when I try to do a search by typing "7396198", the "Loading content. Please wait" never disappears, so search is not working.

I can do an assertion for whether "Loading content. Please wait." text is present and validate the search functionality.

But as shown in the screenshot, the console log indicates that there is an internal server error.

Is there a better programmatic approach to validating this search functionality with the help of console log details?

4
  • You need a module that can post a request and get a response. Using it along selenium, you may be able to capture messages returned by a server.
    – Yu Zhang
    Commented Feb 1, 2017 at 6:51
  • You mean another project with the help of SoapUI or postman
    – ChathuD
    Commented Feb 1, 2017 at 6:55
  • not necessarily a new project, import a module and use it.
    – Yu Zhang
    Commented Feb 1, 2017 at 7:25
  • Import a module,. Can you please tel me how to do that, or give me a reference to follow.
    – ChathuD
    Commented Feb 1, 2017 at 8:22

2 Answers 2

1

It is possible to read the logs with Selenium in C#:

logs = driver.Manage().Logs.getLog(LogType.Browser)

Still I am not sure I would parse them, except maybe looking they are empty.

Test behavior not the implementation, the implementation will probably change more often then the behavior. You do not want to change tests when the implementation changes.

0

As for the current test case I think the best thing to do is:

1- Search for something that is not there and add an assertion for the existence of "No results are available for your search" message existence or anything similar.

2- search for something that will definitely return results and check if results are displayed (results table is filled) or anything similar.

I will vote against checking the request, because generally it might not mean that the search is failing, maybe after you get the response, there is a retry mechanism, or the results are received successfully in the response but they are not displayed in a proper way.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.