Time for action – getting the current status of application cache - Selenium

One of the things that you will want to constantly do during your testing is to make sure that the application cache is storing your files. We can see if they have been downloaded.

  1. Create a new test class using the example code at the beginningof the chapter.

  2. In this part we are just going to check if the application cache is working. We do this by doing:
    AppCacheStatus status = (ApplicationCache) driver).getStatus();

  3. The status should be equal to uncached when we load it.

  4. The final class should look like the following:

What just happened?

We have just seen how we can get the application cache from the browser using the API built into the Selenium WebDriver. We will get an enum returned that relates to the current status that the browser returns. Now we know that we have the means to start to have a look at how our web application will act if it were to become offline.


All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Selenium Topics