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..

1 Answer 1

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:

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.