To maximize the active Window :
To DoubleClick an Element
public void windowMaximize() {
((JavascriptExecutor) driver).executeScript("if (window.screen){window.moveTo(0, 0);window.resizeTo(window.screen.availWidth,window.screen.availHeight);};");
}
To DoubleClick an Element
public void doubleClick(WebElement webElement) {
//For FF browser.
((JavascriptExecutor)driver).executeScript("var evt = document.createEvent('MouseEvents');"
+ "evt.initMouseEvent('dblclick',true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0,null);"+ "arguments[0].dispatchEvent(evt);",webElement);
//For IE
//((JavascriptExecutor)driver).executeScript("arguments[0].fireEvent('ondblclick');", webElement);
}
1 comment:
Thanks a lot! It saved my day.
Post a Comment