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
Explain the difference between confirming and verifying commands?
How to get the number of frames on a page?
What is Selenese?
What kind of keyboard operations can be performed in selenium?
What the webdriver supported mobile testing drivers do you know?
What is an absolute xpath?
What is a keyword driven framework?
How can we maximize browser window in selenium?
How does one submit a form in selenium?
what is the use of x-path?
Give selenium ide tool disadvantage?
What are different types of locators?
Which is the only browser that supports selenium ide to be used?
How to run a group of test cases using testng?
How is assert command different from verify command?