Answer Posted / bharat
You can use ROBOT API jars to upload the file. Simply trigger the browse button and when you need to give the location of your file to upload use Robot API to send the location and then again using Robot API press enter.
try {
//Setting clipboard with file location
setClipboardData(fileLocation);
//native key strokes for CTRL, V and ENTER keys
Robot robot = new Robot();
robot.keyPress(KeyEvent.VK_CONTROL);
robot.keyPress(KeyEvent.VK_V);
robot.keyRelease(KeyEvent.VK_V);
robot.keyRelease(KeyEvent.VK_CONTROL);
robot.keyPress(KeyEvent.VK_ENTER);
robot.keyRelease(KeyEvent.VK_ENTER);
} catch (Exception exp) {
exp.printStackTrace();
}
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
How you can switch back from a frame?
How to handle hidden elements in selenium webdriver?
Explain how to iterate through options in test script?
Explain what are the junits annotation linked with selenium?
What is the difference between driver.close() and driver.quit command?
How does one calculate the number of rows using selenium 2.0?
Explain how you will login into any site if it is showing any authentication popup for username and password?
How to install use TestNG in selenium webdriver ?
What programing language is most useful for creating selenium evaluations?
Can we use selenium rc for tests driving on two different browsers on one operating system without selenium grid?
How to enter text in the HTML text box without invoking the SendKeys ()?
Which technique should you consider using throughout the script “if there is neither frame id nor frame name”?
What exactly is selenium remote-control (rc) tool?
How to download a file in selenium webdriver?
When do you use selenium grid?