//input[@type='file']
document.getElementById("myImg").style.visibility = "visible";
driver.findElement(By.xpath("//input[@type='file']")).sendKeys("/absolute/filepath.jpeg");
It will upload file.
Let me know in case of any queries :)
public static void main(String[] args) { WebDriver driver = new FirefoxDriver(); driver.get("https://how-old.net/"); ((JavascriptExecutor) driver).executeScript("arguments[0].style.visibility = 'visible'; arguments[0].style.height = '1px'; arguments[0].style.width = '1p'; arguments[0].style.opacity = 1",driver.findElement(By.id("uploadBtn"))); driver.findElement(By.id("uploadBtn")).sendKeys("C:\\img.jpeg"); }
Cheers,
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/c25d06cf-fe26-428d-94c5-d38b0967b725%40googlegroups.com.--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
WebDriver driver = new FirefoxDriver(); driver.get("https://how-old.net/"); ((JavascriptExecutor) driver).executeScript("arguments[0].style.visibility = 'visible'; arguments[0].style.height = '1px'; arguments[0].style.width = '1p'; arguments[0].style.opacity = 1",driver.findElement(By.id("uploadBtn"))); driver.findElement(By.id("uploadBtn")).sendKeys("C:\\img.jpeg");
arguments[0].style.width = '1p'
Can someone suggest why do we need to set all the attributes why can't this be done by only making it(arguments[0].style.visibility = 'visible') visible.
Thanks,
Milan