O'Reilly logo

Mastering Selenium WebDriver 3.0 by Mark Collin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Why do you keep repeating yourself?

After you have been writing automated checks for a while, you tend to see similar patterns emerging. One of the most common bad patterns that you will see is tests that interact with the same page, and the same elements on that page, in different ways.

This normally happens because more than one person has been automating scenarios in the same area, and as with all things, different people have different ways of doing things.

Let's take as an example a couple of basic HTML pages. First of all, we will have our index page. This is the page that everybody is going to see when they navigate to our website:

<!DOCTYPE html> <html lang="en"> <head>     <title>Some generic website</title> <link href="http://cdnjs.cloudflare.com/ajax/libs/twitter- ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required