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 does testng allow you to state dependencies? Explain it with an example.
Which web driver implementation is the fastest?
How to iterate through options in test script?
How to export the tests from selenium ide to selenium rc in different languages?
List some scenarios which we cannot automate using selenium webdriver?
From selenium ide how you can execute a single line?
How to handle alerts in selenium webdriver?
How to type in a textbox using selenium?
What is implicit wait in selenium webdriver?
What are the challenges in handling ajax call in selenium webdriver?
How do you get the current page url?
How is a statement different from verification?
How selenium grid works?
How will you use selenium to upload a file?
How you are integrating cucumber feature files with step files?