Assert localStorage state
Medium70 pts~25 min
- localStorage
- JavaScript execution
Practice app · Document Vault
File upload and download, cookies, localStorage, sessionStorage and JavaScript execution.
Your starter code already declares TEST_URL — never hardcode a host.
Objective
Read and change localStorage with JavaScript execution and verify the page reflects the new value.
Your task
- 1Click #save-local and assert #local-value reads “theme=dark”.
- 2Assert executeScript("return localStorage.getItem('theme')") returns “dark”.
- 3Set the value with executeScript("localStorage.setItem('theme', 'light')").
- 4Wait until #local-value reads “theme=light”.
Acceptance criteria
- localStorage is read and written via executeScript
- #local-value shows theme=light
- At least 2 assertions pass
Selenium WebDriver 4 · Selenium · Files, windows & storage