Leanpub Header

Skip to main content

Practical Web Test Automation with Selenium WebDriver and RSpec

Test web applications wisely with Selenium WebDriver

Practical Web Test Automation with Selenium WebDriver and RSpec
This book is 100% completeLast updated on 2026-10-22

In the era of AI coding, software development bottlenecks are shifting. Automated end-to-end (E2E) UI regression testing is becoming more important than ever, providing the essential safeguard that enables teams to deliver software faster without sacrificing quality.

Minimum price

$25.00

$40.00

You pay

Author earns

$

Also available for 1 book credit with a Reader Membership

PDF
EPUB
WEB
APP
342
Readers
357
Pages
56,568Words
About

About

About the Book

While few people deny the benefits of test automation, comprehensive automated testing via UI (browser for web applications) is rarely implemented in software projects. Common reasons for projects' failed attempts at test automation are:

  • Difficult to learn - test scripts are complex, and testing tools are not easy to use
  • Hard to maintain - UI tests are vulnerable to application changes
  • Long feedback loop - automated tests take too long to run

To succeed in automated testing via UI, software projects need to overcome all these 3 challenges.

This book presents a practical approach to implementing test automation for web applications. Topics include:

  • Developing easy to read and maintain Selenium WebDriver tests using a next-generation functional testing tool
  • Page object model
  • Functional Testing Refactorings
  • Cross-browser testing
  • Setting up a continuous testing server to manage the execution of a large number of automated UI tests
  • Requirement traceability matrix
  • Strategies on team collaboration and test automation adoption in projects and organizations

To help readers learn more effectively, the book has a dedicated site containing the following resources:

  • Software. Test automation is not necessarily expensive. All test frameworks featured in this book are free and open-source.
  • Sample test scripts. Ready-to-run test scripts for the exercises in the book.
  • Demo websites. Two demo sites were created for readers to try out test scripts.
  • Tutorial screencasts. You will be able to see how exercises are done step by step.

Share this book

Bundle

Bundles that include this book

Author

About the Author

Zhimin Zhan

Zhimin Zhan is the founder and principal agile testing coach of AgileWay Pty Ltd, Australia. As an advisor and coach, he helps organisations implement test automation using Continuous Testing with open technologies, such as Selenium WebDriver / Appium. Zhimin is the creator of TestWise, the next-generation functional testing tool that supports functional test refactorings, and BuildWise, an international award-winning Continuous Testing Server. Zhimin is a frequent speaker and author of 14 books on software testing and programming. He shares his test automation and CI experience on Substack and Medium.

Contents

Table of Contents

Preface

  1. What changed in the 4th edition?
  2. What is unique about this book?
  3. Who should read this book?
  4. How to read this book?
  5. Send me feedback

What is Web Test Automation?

  1. Test automation benefits
  2. Reality check
  3. Reasons for test automation failures
  4. Successful web test automation
  5. Why Selenium WebDriver framework?
  6. Why Ruby language?
  7. Learning approach
  8. Next action

Test Execution Environment Setup

  1. Install Ruby with rbenv (recommended)
  2. Install Selenium WebDriver and RSpec
  3. Verify the Selenium WebDriver + RSpec Installation
  4. Review

First Automated Test

  1. Test Design
  2. Installing TestWise (under 1 minute)
  3. Create Automated Test
  4. Create a test case

How Automated Testing works

  1. Web test automation rhythm
  2. Test syntax frameworks
  3. RSpec execution hooks
  4. Run RSpec tests from the command line
  5. Review

Test Tool

  1. TestWise: Next-Gen Functional Testing IDE
  2. Visual Studio Code Programming Editor
  3. Review

Selenium WebDriver Syntax in Nutshell

  1. Start browser
  2. Selenium WebDriver’s intuitive syntax pattern
  3. Selenium WebDriver locators
  4. Element interactions
  5. Multiple matching elements
  6. Locator chaining
  7. Playwright vs Selenium WebDriver
  8. Review

Gain Productivity

  1. Generic IDE Features
  2. Keyboard shortcuts
  3. More TestWise productivity features
  4. Debugging test scripts
  5. Review

Case Study

  1. Test site
  2. Preparation
  3. Create a test project
  4. Test Suite: Sign in
  5. Test Suite: Select Flights
  6. Enter passenger details
  7. Book confirmation after payment
  8. Run all tests
  9. Review

Maintainable Functional Test Design

  1. Record/Playback leads to unmaintainable test scripts
  2. Success criteria
  3. Maintainable automated test design
  4. Maintain with ease
  5. Case Study: refine test scripts

Test Automation Characteristics

  1. Specific
  2. Clean
  3. Independent
  4. Frequent
  5. Focused
  6. Programmable
  7. Creative
  8. Sustainable
  9. Review

Functional Test Refactoring

  1. Code refactoring
  2. Functional test refactoring
  3. Tool support
  4. Case study
  5. Apply Test Refactorings
  6. Summary
  7. Review

Set up Continuous Execution

  1. Conventional E2E test execution in CI/CD is suboptimal
  2. Selenium Grid (Not Recommended)
  3. BuildWise CT server setup
  4. Sequential Execution
  5. Parallel execution
  6. Review

Preparing for Real-World Test Automation

  1. Syntax errors
  2. Beyond syntax errors
  3. Set up source control
  4. Test Data
  5. Choose Robust Locators
  6. Stablize Tests
  7. Test script maintenance is the primary effort
  8. Custom libraries
  9. Debugging
  10. What is the best learning method?
  11. Review

Team Collaboration

  1. Pre-requisite
  2. Developer-Tester Collaboration Scenario 1: “It worked on my machine”
  3. Developer-Tester Collaboration Scenario 2: Programmers help QA engineers with technical challenges
  4. Developer-Tester Collaboration Scenario 3: Acceptance Test-Driven Development
  5. Business Analysts find E2E test automation useful too
  6. Review

Clarifications

  1. Real E2E Test Automation is far more challenging than coding
  2. Neither possible or necessary to achieve 100% coverage
  3. Gherkin BDD Framework
  4. Headless testing
  5. Codeless/Scriptless Test Automation
  6. AI/Agentic Test Automation
  7. Cross-browser functional testing
  8. Data-Driven Testing
  9. Review

Adopting End-to-End Test Automation

  1. Seek executive sponsorship
  2. Choose a test framework
  3. Select a test tool
  4. Run as part of the CI/CD pipeline
  5. Find a mentor
  6. Manage expectations
  7. Solo test automation
  8. Common mistakes
  9. Review

AI Won’t Replace Real Human E2E Test Automation

Afterword

Appendix 1 Functional Test Refactoring Catalog

  1. Extract Function
  2. Move Test Scripts
  3. Extract to Page Class
  4. Introduce Page Object
  5. Rename

Appendix 2 Case Study: Test Automation in WhenWise App Development

  1. Build Stats
  2. Questions and Answers

Resources

  1. Books
  2. Tools
  3. Blog

References

Get the free sample chapters

Click the buttons to get the free sample in PDF or EPUB, or read the sample online here

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub