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 do you capture an element loading after the page load?
How can we handle pop-ups in rc?
What is testng assert and list out some common assertions supported by testng?
What is the command that is used in order to display the values of a variable into the output console or log?
What are the different Exceptions in selenium?
What are the significant changes in upgrades in various selenium versions?
How is assert command different from verify command?
What is the main disadvantage of implicit wait?
Explain Cucumeber Framework?
What test can selenium perform?
What must one set within side in order to run a test from the beginning to a certain point within the test?
where do u maintain all your test cases in manual not in selenium
What are the uses of findelement() and findelements()?
When do we use findelement() and findelements()?
How to perform double click action in selenium webdriver?