Book Image

Learning Selenium Testing Tools - Third Edition

Book Image

Learning Selenium Testing Tools - Third Edition

Overview of this book

Table of Contents (22 chapters)
Learning Selenium Testing Tools Third Edition
About the Author
About the Reviewers

Working with WebStorage

Some of the other technologies that are being developed for HTML5 are related to WebStorage. There are three main WebStorage technologies:

  • Local storage

  • Session storage

  • WebSQL

In this section of the chapter, we will only be working with the first two since WebSQL is not being implemented by all of the browser vendors. These technologies allow us to save to the users' hard disk and then retrieve what we stored.

Local storage

In this section, we will have a look at local storage to make sure that items we expect to be there are really there. This is analogous to an integration test that accesses a database to check whether something has been sorted. LocalStorage allows data to be stored and the data is persisted between sessions the browser is closed and reopened.

The Selenium WebDriver object called LocalStorage is used to access the local storage in the browser. The API is nearly a 1:1 match for the JavaScript API that comes with browsers.

Let's see this in action.