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 to insert a start point in selenium ide?
How can we create object repository in selenium?
What are the different types of annotations which are used in selenium?
Explain me how can we capture screenshots in selenium?
Explain in selenium ide how can you debug the tests?
How to find the xpath of web table elements.in chrome or internet explorer.or without using fire bug.?
How can we deal with pop-up windows based on?
Explain the different kinds of frameworks in automation?
What is the selenium's recording language?
How is testng better than junit?
How to handle https website in selenium? Or how to accept the ssl untrusted connection?
How to validate the dropdown value contains specific value or not?
What are the types of waits available in selenium webdriver?
How to change the url on a webpage using selenium web driver?
How do perform drag and drop using selenium webdriver?