0

i am trying to automate Blueimp file upload. but keep getting ElementNotVisible Exception.

WebElement fileUpload = driver.findElement(By.xpath("//input[@type='file']"));
String imagePath = "image.png";
fileUpload.sendKeys(imagePath);

I tried to enable using:

((JavascriptExecutor)driver).executeScript("arguments[0].checked = true;", fileUpload);`

but still no luck..

alecxe
  • 462,703
  • 120
  • 1,088
  • 1,195
rid
  • 5
  • 2

1 Answers1

1

One option to solve it would be to make an element visible:

WebElement fileUpload = driver.findElement(By.xpath("//input[@type='file']"));
((JavascriptExecutor)driver).executeScript("arguments[0].style.display = 'block'; arguments[0].style.visibility = 'visible';", fileUpload);

String imagePath = "image.png";
fileUpload.sendKeys(imagePath);

See also:

Community
  • 1
  • 1
alecxe
  • 462,703
  • 120
  • 1,088
  • 1,195