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
What do we mean selenium selenium 1 and 2?
Can I navigate back and forth in a browser in selenium webdriver?
How can we check if an element is enabled for interaction on a web page?
What is the selenium's recording language?
How do you handle alert popup?
What is a node in selenium grid?
What differs the configuration of Selenium Selenium 2.0 1.0?
Explain Cucumeber Framework?
What is pom (page object model)? What are its advantages?
How to switch to a new window (new tab) which opens up after you click on a link?
Explain how can you find broken links in a page using selenium webdriver?
What are the benefits of automation testing?
What does a knot do on the selenium grid?
How testing is better than junit?
How to submit a form using selenium webdriver?