This following sample code used for the double click operation.
WebElement oWE = driver.findElement(By.xpath("XXXXXXXX"));
if (oWE.isDisplayed()) {
System.out.println("Displayed");
Thread.sleep(4000);
Actions oAction = new Actions(driver);
oAction.moveToElement(oWE);
oAction.doubleClick(oWE).build().perform();
Thread.sleep(4000);
oWE.click();
}
For handling Dialog boxes which are not web based, Then Autoit is the best Tool to handle this These are the following code should written in Selenium Selenium Code: try { String[] commands = new String[] {}; commands = new String[] { "Path" }; // location of Autoit EXE file Runtime.getRuntime().exec(commands); } catch (IOException e) { } Autoit code: if WinWaitActive("File Upload") Then ;MsgBox(2,"window found","Found the window") WinActivate("File upload") Send("!n") Sleep(5000) Send("File path") SEND("{ENTER}") ;location of the file you want to a to the form and submit ;Send("!O") Else MsgBox(1,"TimeOut","Timed out") EndIf Here we need to create a Exe file for the Autoit script and that path should be mentioned in selenium code.
Comments
Post a Comment