Bird
0
0

You want to verify that a file named 'report.xlsx' has been downloaded successfully using Selenium Python. Which approach is best to confirm the download in an automated test?

hard📝 Application Q15 of 15
Selenium Python - Advanced Patterns
You want to verify that a file named 'report.xlsx' has been downloaded successfully using Selenium Python. Which approach is best to confirm the download in an automated test?
ACheck the page source for the file name
BCheck the browser's download history via Selenium API
CWait for an alert popup confirming download
DUse os.path.exists() to check the file in the download folder
Step-by-Step Solution
Solution:
  1. Step 1: Understand Selenium's download verification limits

    Selenium cannot access browser download history or alerts for downloads.
  2. Step 2: Use file system check

    Checking file existence with os.path.exists() in the download folder confirms the file saved.
  3. Final Answer:

    Use os.path.exists() to check the file in the download folder -> Option D
  4. Quick Check:

    File system check confirms download = A [OK]
Quick Trick: Verify downloads by checking file presence on disk [OK]
Common Mistakes:
  • Trying to read browser download history
  • Waiting for non-existent alert popups
  • Searching page source for downloaded file

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Selenium Python Quizzes