Not Able to Download a File in IE Browser using Robot Class
Not Able to Download a File in IE Browser using Robot Class
M
Posted on 17/07/2016
I am trying to download a file in IE browser (version 10) and used Robot class to achieve the same but it doesn't seem to be working. Below is the code. driver.get("http://qtpselenium.com/test/testdownload.php"); driver.findElement(By.xpath("html/body/a[1]")).click(); Thread.sleep(2000); Robot rb = new Robot(); rb.keyPress(KeyEvent.VK_ALT); rb.keyPress(KeyEvent.VK_N); rb.keyRelease(KeyEvent.VK_ALT); rb.keyRelease(KeyEvent.VK_N); rb.keyPress(KeyEvent.VK_TAB); rb.keyPress(KeyEvent.VK_ENTER);
I also tried this: rb.keyPress(KeyEvent.VK_ALT); rb.keyPress(KeyEvent.VK_S); rb.keyRelease(KeyEvent.VK_ALT); rb.keyRelease(KeyEvent.VK_S);
But the file is not getting downloaded.
Could you please help me on this and let me know if something is wrong in the above code.