I've been using the following example to maximize my windows in my WebDriver tests, I upgraded to Firefox 7, and the script quit working. I don't get an error, the window just does not maximize, wondering if anyone else has seen this or know why it's no longer working, or another way to do it..
my current code that worked before FireFox 7...
public static final String MAXIMIZE_BROWSER_WINDOW = "if (window.screen) {window.moveTo(0, 0);window.resizeTo(window.screen.availWidth,window.screen.availHeight);};";
public static Object maximizeBrowserWindow(WebDriver driver) {
return executeJavascript(driver, MAXIMIZE_BROWSER_WINDOW);
}
private static Object executeJavascript(WebDriver driver, String script){
JavascriptExecutor js=(JavascriptExecutor) driver;
return js.executeScript(script);
}
Firefox 7 disabled the ability to modify the main window via JavaScript. The issue report can be found in the Mozilla bug tracker. There have been some discussions of workarounds, on the WebDriver users mailing list, but none of them are particularly pretty.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With