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 is assertion in selenium and what are the types of assertion?
What is heightened privileges browsers?
List the different types of locaters in selenium.
What are the challenges in handling ajax call in selenium webdriver?
How can we select elements by their attribute value using css selector?
selenium can handle pop-up windows based on selenium is a test tool?
What are some limitations of selenium?
List out the technical challenges with selenium?
Tell me what kind of mouse actions can be performed in selenium?
What are testing types supported by selenium?
Mention what is desired capability? How is it useful in terms of selenium?
Can I navigate back and forth in a browser in selenium webdriver?
What are the different methods to refresh a web page in webdriver?
What are the features of selenium ide ?
How to handle hidden elements in selenium webdriver?