2

I would like to automate the following process:

  1. Create a sitemap of a certain domain.
  2. Check all pages are up.

I don't come up with any good enough tool for the second step. I used to assertion if an element exists, using Selenium, but would be crazy if the sitemap is large.

Is there any way to perform step 2 easily?

  • 1
    What do you mean when you say page is up and what do you mean when you say easily? Depending on how you treat these terms the answers could be different. – Alexey R. Dec 11 '18 at 18:23
  • Hi. In my case I mean loaded for page is up and using any script without any help form external programs, just my testing tool, by easily. Thank you for the point. – atsQA Dec 13 '18 at 14:02
5

You basically have 3 options, depending on what you really want to do.

  1. Test whether a page correctly shows the content it`s supposed to

Selenium's webdriver.get($URL) waits for the page to load completely, as in the "cancel loading" button in your browser changes to "refresh". Otherwise you could implicitly wait (https://www.seleniumhq.org/docs/04_webdriver_advanced.jsp) for all the elements you want loaded. Then you can take a screenshot / test the page.

  1. Test whether a page contains all the elements you want

A better option would be to use a webscraping library to GET the particular page and check whether it contains specified elements and text. This will be much faster than Selenium. However, there is no GUI and you might run into some problems with parsing.

  1. Check that the page returns correct status code

In this case, I`d use something like Postman or Python requests library (or a HTTP library for a language of your choice). Send a GET request to the page and check that it returns the status code you want.

|improve this answer|||||
  • Good answer. Note on point #1 - all the code and js may be loaded but then the js may execute and change content. This leads to a lot of element find issues when there is js on the page even though it is fully loaded. – Michael Durrant Dec 12 '18 at 13:32
  • You may be able to check for page fully rendered and/or no javascript running to at least partly allow for that. Not sure exactly what selenium checks myself. – Michael Durrant Dec 12 '18 at 13:33

Your Answer

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

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