Chapter 2. Testing Web Pages

In this chapter, we will cover:

  • Checking whether page links are broken
  • Deleting cookies
  • Managing multiple browser windows
  • Handling pop-up dialogs
  • Downloading a file using XMLHttp
  • Checking whether a website is up
  • Uploading a file using FTP
  • Identifying elements based on anchors
  • Synchronizing a test with a web page loading
  • Accessing web elements through DOM

Introduction

Unlike desktop (client) applications, the Web poses specific challenges that go beyond the local machine. For instance, a web page may not display the intended content correctly with regard to content, format, layout, and even functionality, due to missing or corrupted resources located on a remote server. An application server, a database server, a Cascading Style Sheet (CSS), and a configuration or JavaScript file (.js) are among the resources that may have an impact on the web application functioning. Other challenges include the integrity of the links, JavaScript bugs, and caching effects, to name a few. Security issues may also prevent web pages from displaying contents properly, as is the case with images loaded across domains.

Automating tests for the GUI of a web page poses challenges related to script page synchronization, object identification, and checking dynamic content, among others. This chapter describes various common automation tasks related to the testing of web pages.

Note

This chapter is not intended to be a tutorial on web technology, so some basic background is required, for instance, being acquainted with basic concepts such as Document Object Model (DOM). To learn about DOM, it is recommended that you refer to the official specification at http://www.w3.org/TR/DOM-Level-3-Core/introduction.html.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset