Selenium 2.41.0 webdriver working with Java robot -
I have just upgraded from Selenium 2.37.1 to 2.40.0 and came into a problem.
I am using Selenium Webdriver to run a test in a project. One page is using a plupload which opens an uploader window, which I was automating in my Selenium with a Java robot.
Since upgrading to 2.40.0, however, when it goes to Plupload, the WebDrive is hanging until the upload window closes manually and the robot will start its command < / P>
It was not an issue with 2.37.1. Has anybody come in the same problem and is fine? Is there any other way to handle Upload Window with WebDrive?
Thank you.
You can do this by using the following types of code: < / Blockquote>
Type 1: Using sendkey
WebElement upload = driver.findElement (by .id ("upload")); Upload.sendKeys ("Path of your file");
Type 2: Use of Java robot class
WebElement upload = driver.findElement (By.id ("upload")); Upload.click (); Setclipboard data ("Path of your file"); 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.delay (5000); Robot.keyPress (KeyEvent.VK_ENTER); Robot.keyRelease (KeyEvent.VK_ENTER);
Comments
Post a Comment