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 what can cause a selenium ide test to fail?
What are the capabilities of selenium ide?
Mention what are the advantages of using git hub for selenium?
Explain the different exceptions in selenium webdriver.
How do I upload a file using selenium? I need to upload a word file during test execution.
Explain the difference between confirming and verifying commands?
How can we capture screenshots in selenium?
What is the difference between verify and assert commands?
Can we use selenium rc for tests driving on two different browsers on one operating system without selenium grid?
What are the verification points available in selenium?
Can we edit recorded selenium ide test cases?
Tell me how to verify tooltip text using selenium?
Explain the fundamental difference between xpath and css selector.
What is the selenium ide and what is it used for?
What are driver.close and driver.quit in WebDriver? Which is more preferable?