O'Reilly logo

Selenium Design Patterns and Best Practices by Dima Kovalenko

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

The Action Wrapper pattern

The idea behind the Action Wrapper pattern is to collect all of the most common pain points, such as AJAX, and automatically implement them every time that action is performed. It helps to future proof the tests by automatically accounting for things that commonly go wrong and destabilizing the tests.

Advantages of the Action Wrapper pattern

The Action Wrapper pattern has a lot more advantages than disadvantages; let's take a look at them:

  • Single location for actions: All of the actions such as clicking, typing, and dealing with AJAX requests and animations are in a single class. This makes them easy to find and modify and very DRY.

    Note

    The DRY principle and the DRY pattern are discussed in Chapter 3, Refactoring Tests

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