Challenge - 5 Problems
Excel Data Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
What is the output of this Excel data reading code?
Given the following Python code snippet using openpyxl to read an Excel file, what will be printed?
Selenium Python
from openpyxl import load_workbook wb = load_workbook('testdata.xlsx') sheet = wb.active value = sheet['B2'].value print(value)
Attempts:
2 left
💡 Hint
Check if the file exists and the cell B2 has data.
✗ Incorrect
The code loads the Excel file and reads the value in cell B2. If the file exists and B2 has data, it prints that data.
❓ assertion
intermediate1:30remaining
Which assertion correctly verifies the Excel cell value?
You read a value from Excel cell A1 into variable 'cell_value'. Which assertion correctly checks it equals 'TestUser'?
Selenium Python
cell_value = sheet['A1'].valueAttempts:
2 left
💡 Hint
Use double equals for comparison in assertions.
✗ Incorrect
Option C uses the correct equality operator '==' to compare values. Option C uses assignment which is invalid syntax. Option C asserts inequality which is wrong. Option C uses 'is' which checks identity, not equality.
❓ locator
advanced2:00remaining
Choose the best locator to find a cell value in Selenium after reading from Excel
You read a username from Excel and want to find the input box on a web page to enter it. Which locator is best practice?
Attempts:
2 left
💡 Hint
Use unique and stable locators.
✗ Incorrect
ID locators are unique and fast. XPath and CSS selectors can work but may be less stable or slower. Tag name alone is too generic.
🔧 Debug
advanced2:00remaining
Identify the error in this Excel reading code snippet
What error will this code raise?
Selenium Python
from openpyxl import load_workbook wb = load_workbook('data.xlsx') value = wb['Sheet1']['A1'] print(value.value)
Attempts:
2 left
💡 Hint
Check how to access sheets in openpyxl.
✗ Incorrect
No error is raised. Workbook objects are subscriptable by sheet name (wb['Sheet1'] returns the worksheet), worksheets are subscriptable by cell address (['A1'] returns the Cell), and cell.value gets the data.
❓ framework
expert2:30remaining
Which test framework feature best supports reading Excel data for multiple test cases?
You want to run a Selenium test multiple times with different data from Excel. Which pytest feature helps best?
Attempts:
2 left
💡 Hint
Think about running tests multiple times with different inputs.
✗ Incorrect
Parametrize decorator allows running the same test with different inputs easily. Fixtures can help but parametrize is designed for multiple data sets. Hardcoding is not flexible. unittest setUp runs before each test but does not parametrize.