Member-only story
Selenium Workbook #47: Print An Invoice (File Download)
Test File Download and Verify in Selenium WebDriver
4 min readOct 5, 2024
This article is one of the “Web Test Automation Workbook” series, a set of bite-sized exercises (typically 15–20 mins). A practical and satisfying way to learn web test automation with Selenium WebDriver.
Learning Objectives
- Design reliable automated tests that are user aware.
- Customize the Chrome browser to save downloaded files into a specified folder
- Verify a File Exists
- Awareness of execution side effects: the file already exists
- Review:
"#{variable}/..."
Test Case #47
Test design
- Login (business):
physio@biz.com
(password:test01
) - Create an invoice (See Exercise #46)
- Click the “Print” link, wait up to 5 seconds, and then check the PDF file is generated.
Obviously, the focus of this exercise is to check the downloaded file. It appears very simple during manual testing. However, in test automation, we need to consider the following:
- How to verify a file exists?
This is easy: use code.