We can handle this using java script or by send sendKeys()function:
1. Using sendKeys():
WebElement upload = driver.findElement(By.id("fileUp"));
upload.sendKeys("c:/darkbulb.jpg");
driver.findElement(By.id("submit")).click();
2. Using Javascript:
WebElement upload = driver.findElement(By.id("fileUp"));
((JavascriptExecutor)driver).executeScript("arguments[0].style.visibility = 'visible';
arguments[0].style.height = '1px'; arguments[0].style.width = '1px';
arguments[0].style.opacity =
1", upload );
No comments:
Post a Comment