Quantcast
Channel: Active questions tagged selenium - Stack Overflow
Viewing all articles
Browse latest Browse all 98825

Upload functionality using Robot class in selenium Web Driver

$
0
0

I am using the following code:code runs fine but instead of pasting the path of the file at upload window, it pastes the path on the TestNG console. Does not throw any error and on browser the window pop up remains blank.If someone has faced the same issue then please help me out in it

  StringSelection ss= new StringSelection("D:\\test.docx");
  Toolkit.getDefaultToolkit().getSystemClipboard().setContents(ss,null);

  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);

Viewing all articles
Browse latest Browse all 98825

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>