Wednesday, July 20, 2011

How to do doubleClick on WebElement , WindowMaxmize Using Webdriver

 To maximize the active Window :

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);
}

Monday, July 11, 2011

Selenium - Ajax , Selenium - Dojo, ...

Ref: http://www.ibm.com/developerworks/opensource/library/os-webautoselenium/index.html?ca=drs-