I am using selenium 3.3.1 to run some tests on Firefox 52, and recently switched from the legacy Firefox driver to Marionette (geckoDriver 0.15.0). The method used by the FirefoxDriver is supposed to be
driver.switchTo().window(handle).switchTo().defaultContent();
however this does not work when I am using GeckoDriver.
This is an example of the code which should bring the window to the front:
public static void main( String[] args )
{
DesiredCapabilities dc = DesiredCapabilities.firefox();
dc.setCapability("marionette", true);
System.setProperty("webdriver.gecko.driver", "/Marionette/geckodriver-0.15.0/geckodriver");
FirefoxDriver driver = new FirefoxDriver(dc);
driver.navigate().to("about:addons");
String handle = driver.getWindowHandle();
driver.switchTo().window(handle).switchTo().defaultContent();
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
driver.quit();
}
Could someone tell me if there is a known workaround that could be used?