Scenario:
Using selenium webdriver, one can simulate fileupload easily using sendKeys.
Using firebug, I could see, the button which pops up operating system specific dialog box where file loaction is typed-in has got type=file.
The below is snippet from naukri site, which has got button to upload file.
<input type="file" name="attachCV" id="attachCV" valtype="attachCV" class="">
In case, input type="file", we can pass absolute location of file to be uploaded using sendKeys method exposed by WebElement class.
Ex:
WebDriver wd = new FirefoxDriver();
WebElement we = wd.findElement(By.id = "attachCV");
we.sendKeys(<Absolute FileLocation>);
Using selenium webdriver, one can simulate fileupload easily using sendKeys.
Using firebug, I could see, the button which pops up operating system specific dialog box where file loaction is typed-in has got type=file.
The below is snippet from naukri site, which has got button to upload file.
<input type="file" name="attachCV" id="attachCV" valtype="attachCV" class="">
In case, input type="file", we can pass absolute location of file to be uploaded using sendKeys method exposed by WebElement class.
Ex:
WebDriver wd = new FirefoxDriver();
WebElement we = wd.findElement(By.id = "attachCV");
we.sendKeys(<Absolute FileLocation>);