Skip to content
CodeKruPro

Uploading a file when the browser runs on Grid (Java)

QuizMedium-HardJava onlyAsked in: Accenture, Capgemini, Infosys, TCS

Uploads work locally but fail when the test runs on Selenium Grid: the remote browser cannot find the file. What is the fix in Java?

  • ((RemoteWebDriver) driver).setFileDetector(new LocalFileDetector()); before sending the path
  • Copy the file to the same path on every node by hand
  • Use a JavaScript click on the upload button
  • Nothing: RemoteWebDriver sends local files by default

This question is part of Pro+

Pro+ opens every question in Interview Prep and the mock interview. Every article and the first 2 questions of each topic stay free. Hands-on Selenium and API tasks follow their course lesson's own lock.

See Pro+

Already have Pro+? Sign in