Web Test Automation in Action: Volume 1
Web Test Automation in Action: Volume 1
Hands-On Exercises with Selenium WebDriver and Playwright
About the Book
Test automation, especially End-to-End (UI) test automation, is the foundation of Agile and DevOps. Yet, E2E test automation courses are rarely offered at universities, and many companies don’t seek external training or coaching. This gap is a common reason why most E2E test automation efforts fail.
The best way to learn web test automation is by doing. This book offers a practical, fast, and effective approach for motivated software professionals to master web test automation using two leading automation frameworks: Selenium WebDriver and Playwright. Through 14 carefully crafted exercises, you’ll learn:
- Web Automation Concepts
- Automated Test Design Techniques
- Selenium and Playwright Test Syntax
- Best Practices for Developing and Debugging Test Scripts Efficiently
Ideal for those seeking hands-on exercise to sharpen their test automation skills!
Team Discounts
Get a team discount on this book!
Table of Contents
- Preface
- Why this book?
- What’s unique about this book?
- Who should read this book?
- How to read this book?
- Send us feedback
- Chapter 1:Hello Web Test Automation
- 1.1:Learning Objectives
- 1.2:Tasks
- 1.2.1:Task 1. View automation in action
- 1.2.2:Task 2. Set up Test Automation Tool (for execution)
- 1.2.3:Task 3. Run one automated test yourself
- 1.3:FAQ
- Chapter 2:Web Test Automation Simplified
- 2.1:Learning Objectives
- 2.2:Web Basics
- 2.3:Web Testing means …
- 2.4:Web Test Automation means …
- 2.5:How to Find an Element
- 2.6:Behind a web page is HTML
- 2.7:Tasks
- 2.7.1:Task 1. Change Local Page Content (HTML)
- 2.7.2:Task 2: Show/hide the Hints button (JavaScript)
- 2.7.3:Task 3. Change the reload button style (CSS)
- 2.8:Summary
- Chapter 3:Introduction to Web Automation Frameworks
- 3.1:Learning Objectives
- 3.2:Selenium WebDriver
- 3.2.1:Selenium WebDriver’s intuitive syntax pattern
- 3.2.2:Step 1. Locate the control
- 3.2.3:Step 2. Perform action on the located control
- 3.2.4:Common Controls on a web page
- 3.3:Selenium WebDriver’s Locators
- 3.3.1:ID Locator
- 3.3.2:Name Locator
- 3.3.3:Link Text Locator
- 3.4:Run Selenium Scripts in TestWise
- 3.4.1:Get TestWise in Playgrounds mode
- 3.4.2:Try out automated test steps
- 3.4.3:Knowledge Point: Comment in code/scripts
- 3.5:Playwright
- 3.6:FAQ
- Chapter 4:User Sign in OK Test
- 4.1:Exercise #04
- 4.2:Learning Objectives
- 4.3:Tasks
- 4.3.1:Selenium WebDriver
- 4.3.2:Playwright
- 4.4:Full Test Script
- 4.4.1:Selenium WebDriver
- 4.4.2:Playwright
- 4.5:Common Issues
- 4.6:FAQ
- Chapter 5:Multi-Login Tests
- 5.1:Exercise 05
- 5.2:Learning Objectives
- 5.3:Test Design
- 5.3.1:Knowledge Point: Automation + Test Syntax Frameworks
- 5.4:Learn RSpec in under a minute
- 5.4.1:Before and After test case sections in RSpec
- 5.5:The test syntax framework in @playwright/test
- 5.5.1:@playwright/test sytnax and structure
- 5.5.2:Variations of @playwright/test syntax
- 5.6:Tasks
- 5.6.1:Selenium WebDriver + RSpec
- 5.6.2:Playwright Test
- Chapter 6:Alternative Login Tests
- 6.1:Exercise 06
- 6.2:Learning Objectives
- 6.3:Test Design
- 6.4:TestWise Productivity Tips (Selenium)
- 6.4.1:Tip 1. Faster (and Safer) Typing Selenium Statements
- 6.4.2:Tip 2. Script Validation
- 6.4.3:Tip 3. Reformat
- 6.4.4:Tip 4. IntelliSense (sort of)
- 6.4.5:Tip 5. Script Library
- 6.5:Visual Studio Code (Playwright)
- 6.6:Test Script
- 6.6.1:Selenium RSpec
- 6.6.2:Playwright Test
- Chapter 7:Test Execution Side Effects
- 7.1:Exercise 07
- 7.1.1:Test Data
- 7.2:Learning Objectives
- 7.3:Tasks
- 7.3.1:Task 1. Run two test cases individually, one by one
- 7.3.2:Task 2. Run the test script (i.e. all test cases)
- 7.3.3:Knowledge Point: Execution Side Effect
- 7.3.4:Knowledge Point: Two Test Execution Modes
- 7.3.5:Task 3. Analyse and Fix
- 7.3.6:Task 4. Make the sign off step works for any user
- 7.4:Playwright
- 7.5:Test Scripts
- 7.5.1:Selenium WebDriver + RSpec
- 7.5.2:Playwright Test
- 7.6:FAQ
- 7.1:Exercise 07
- Chapter 8:Select One-way Flight
- 8.1:Exercise 08
- 8.2:Learning Objectives
- 8.3:Test Design
- 8.4:Tasks
- 8.4.1:Task 1. Clone an existing test script (TestWise)
- 8.4.2:Task 2. Start developing a new test case, one-way trip.
- 8.4.3:Task 3. Click the one-way radio button
- 8.4.4:Knowledge point: XPath Locator
- 8.4.5:Task 4. Select a city from a drop-down list.
- 8.4.6:Knowledge point: Select an option in a Select List.
- 8.4.7:Task 5. Complete the remaining test steps in debugging mode.
- 8.5:Playwright Test
- 8.6:Test Script
- 8.6.1:Selenium + RSpec
- 8.6.2:Playright Test
- Chapter 9:Select Return Flight
- 9.1:Exercise 09
- 9.2:Learning Objectives
- 9.3:Test Design
- 9.4:Tasks
- 9.4.1:Task 1. Add the “selecting departure date” in “one-way flight” test.
- 9.4.2:Task 2. Click the ‘Return’ radio button.
- 9.4.3:Task 3. Select departure and return dates from dropdown lists.
- 9.4.4:Task 4. Make the two tests pass.
- 9.4.5:Debugging Tip: keep the browser open temporarily in “test script execution mode”
- 9.5:Test Script
- 9.5.1:Selenium RSpec
- 9.5.2:Playwright Test
- Chapter 10:Enter Passenger Name
- 10.1:Exercise 10
- 10.2:Learning Objectives
- 10.3:Test Design
- 10.4:Knowledge Point: Assertion
- 10.4.1:Assert the page text contains
- 10.4.2:Assert the page title
- 10.4.3:Assert a control’s state
- 10.4.4:Assert a text control’s value
- 10.5:Tasks
- 10.5.1:Task 1. Create a new test script based on a flight test
- 10.5.2:Task 2. Verify the entered passenger name in a text box
- 10.6:Assertions in Playwright Test
- 10.7:Test Scripts
- 10.7.1:Selenium RSpec
- 10.7.2:Playwright Test
- Chapter 11:Various ways of execution test scripts
- 11.1:Exercise 11
- 11.2:Learning Objectives
- 11.3:Tasks
- 11.3.1:Task 1. Check/Uncheck a checkbox
- 11.3.2:Task 2. Check/Uncheck a checkbox safely (Selenium)
- 11.3.3:Task 3. Check/Uncheck a checkbox safely (Playwright)
- 11.4:Knowledge Point: Various Ways to Execute Tests
- 11.5:Execute Tests in a Testing Tool
- 11.5.1:TestWise
- 11.5.2:Visual Studio Code
- 11.6:Execute Tests in a Command Window or Terminal
- 11.6.1:Execute RSpec Tests
- 11.6.2:Execute Playwright Tests
- Chapter 12:Payment Test (AJAX)
- 12.1:Exercise 12
- 12.2:Learning Objectives
- 12.3:Test Design
- 12.4:Tasks
- 12.4.1:Task 1: Create a new test script that completes all the steps outlined in the test design.
- 12.4.2:Knowledge Point: “Flaky Tests”
- 12.4.3:Knowledge Point: AJAX
- 12.4.4:Knowledge Point: Waiting in Selenium
- 12.4.5:Task 2: Make the test case reliable
- 12.4.6:Task 3: Assert booking number
- 12.4.7:Task 4: Implement all four Waits
- 12.5:Playwright
- 12.6:Test Scripts
- 12.6.1:Selenium RSpec
- 12.6.2:Playwright Test
- Chapter 13:Sony Playstation Login Test
- 13.1:Exercise 13
- 13.2:Learning Objectives
- 13.3:Tasks
- 13.3.1:Task 1. Click the “Sign In”
- 13.3.2:Task 2. Stabilize the Ppath expression
- 13.3.3:Task 3. Locate the “Sign-In ID (Email Address)” text box
- 13.3.4:Task 4. Add Waiting (Selenium)
- 13.3.5:Task 4. Add Waiting (Playwright)
- 13.4:Test Script
- 13.4.1:Selenium WebDriver + RSpec
- 13.4.2:Playwright Test
- Chapter 14:Testing Page with iFrames
- 14.1:Exercise 14
- 14.2:Learning Objectives
- 14.3:Tasks
- 14.3.1:Task 1. Add a new test script in a test folder
- 14.3.2:Task 2. Implement the first test step: enter email address
- 14.3.3:Knowledge Point: Frame and iFrame
- 14.3.4:Task 3. Drive controls in a frame
- 14.4:Handle Frames in Playwright
- 14.5:Test Script
- 14.5.1:Selenium WebDriver + RSpec
- 14.5.2:Playwright Test
- Afterword
- Practice makes perfect
- Apply your newly learned test automation at work
- Automation
- Learn and grow
- Appendix 1 Test Execution Setup
- Selenium WebDriver
- Install Selenium Ruby
- Set up Test Execution in TestWise Standard Edition
- Playwright
- Install Playwright
- Execute Playwright Test from Command Line
- Set up Visual Code for Playwright Scripting
- Selenium WebDriver
- Appendix 2 Selenium vs. Playwright
- The language debate often leads to nowhere.
- Non technical factors
- Framework comparsiaion
- Quick and Practical Suggestions
- Appendix 3 Practical Advice: Open to Do Both Frameworks at Work
- Why does the “do both” approach work?
- Well-designed top-level E2E test scripts: nearly identical across languages and frameworks
- Go for Productity
- Why does the “do both” approach work?
- Resources
- Books
- Blogs
- Tools
- Preface
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.
Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.
You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!
So, there's no reason not to click the Add to Cart button, is there?
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.)
In fact, authors have earnedover $14 millionwriting, publishing and selling 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