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 the difference between the commit and verify commands?
What is the use of @listener annotation in testng?
How to submit a form using selenium webdriver?
How can we fetch a text written over an element?
How to handle https website in selenium? Or how to accept the ssl untrusted connection?
Explain what can cause a selenium ide test to fail?
What are the different Selenium components?
How to check if a text is highlighted on the page ?
Can we move back and forward in browser using selenium?
What is the purpose of deselecting all() method?
How you can switch back from a frame?
How many types of locators are there in selenium?
How will you verify the specific position of an web element
What is actions class in webdriver
What does a concentrator do in the selenium network?