Selenium / Quiz
Upload Without the Native Dialog
Drive HTML file inputs with local and Grid-safe paths, then assert the server-visible result.
- Difficulty
- Easy
- Format
- Quiz
- Points
- 100
- Estimate
- 6 min
// MISSION BRIEF
Your Mission
Native file choosers sit outside WebDriver's page model. Inspect local and remote Java snippets, choose the supported upload seam, and preserve a useful assertion after the file leaves the test machine.
// FIRST CONTACT
Battle teaser
The page contains <input id="evidence" type="file">. Which local Selenium Java upload is supported? Path file = Path.of("src/test/resources/evidence.png").toAbsolutePath();
- Adriver.manage().addFile(file.toFile());
- Bdriver.findElement(By.id("evidence")).sendKeys(file.toString());
- Cdriver.openNativeFileDialog(file.toString());
- Dnew Actions(driver).upload(file).perform();
Answers, scoring, hints, and the full battle stay sealed.
// SKILL TAGS
selenium-uploadfile-inputgridselenium