I have two test cases of checking file upload which is using same piece of code as written below. For 1 test case it's pasting correct path of file upload but for other test case its only pasting character 'v' and also have anybody have idea why robot class does not work in case of if we run test cases on remote machine on jenkins.
// Lines of code for file upload test case
Robot rob = new Robot();
StringSelection ss = null;
ss = new StringSelection("C:\\repository\\A\\B\\C\\resources\\no_fog.png");
rob.setAutoDelay(2000);
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(ss, null);
rob.setAutoDelay(1000);
rob.keyPress(KeyEvent.VK_CONTROL);
rob.keyPress(KeyEvent.VK_V);
rob.keyRelease(KeyEvent.VK_CONTROL);
rob.keyRelease(KeyEvent.VK_V);
rob.setAutoDelay(1000);
rob.keyPress(KeyEvent.VK_ENTER);
rob.keyRelease(KeyEvent.VK_ENTER);
rob.setAutoDelay(1000);
Can somebody provide any help on this