Category:
Selenium WebDriver
We can click on a button with across browsers with Selenium webdriver. First of all we need to identify the element with the help of locators like xpath or css, then apply sendKeys() method where the path of the file to be uploaded is passed.
// identify element
WebElement l=driver.findElement(By.cssSelector("input[type='file']"));
// file path passed with sendkeys()
l.sendKeys("C:\Users\ghs6kor\Pictures\Desert.jpg");