0

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?

Louis
  • 146,715
  • 28
  • 274
  • 320
  • 2
    So you are able to open the Firefox browser and then passing "about:addons" in the url. Is that happening? What are you trying to do next? – undetected Selenium Mar 29 '17 at 22:31
  • I am trying to bring the newly opened window to the front of the screen using the handle identifier. If this works, the window should move in front of any other open windows. – Annie Lepage Mar 30 '17 at 14:34
  • that should not be the case. When geckodriver opens a new browser instance, the focus is absolutely on the new window. You don't need to switch handle. – undetected Selenium Mar 30 '17 at 14:46

0 Answers0