1

I call the .getAttribute("value") method on an input element with type="file" to get the uploaded filename but it doesn't work. I get an empty string. This works with all other browsers but not Edge. Is this a known Edge bug or am I doing something wrong?

WebElement fileDialog = driver.findElement(By.id("fileDialogID"));
String uploadedFilename = fileDialog.getAttribute("value")
Cosmin
  • 2,354
  • 2
  • 22
  • 39
code4u
  • 119
  • 1
  • 2
  • 10
  • Have you waited for the file to be uploaded? Maybe with Edge the upload is slower than other browsers and when you try to get the name, the file is still not uploaded yet – marco Dec 25 '20 at 17:03
  • @marco Yes, I waited. Did it worked for you? – code4u Dec 25 '20 at 17:07
  • never worked with selenium on Edge, usually in Chrome this works fine, maybe you can try to use `ExpectedConditions.textToBePresentInElement` to wait for the name of the file to be present in the element – marco Dec 25 '20 at 17:11
  • @marco I suspect this is a Selenium Edge driver bug. – code4u Dec 25 '20 at 22:48

0 Answers0