0

Using AWT Robot with Selenium WebDriver + Java, I want to switch browser to full screen mode(that we achieve manually using hitting F11 key). Hence, I wrote following code:

  @Test
  public void f() throws AWTException, InterruptedException {
      Robot robot = new Robot();
      WebDriver driver = new FirefoxDriver();
      driver.get("http://www.google.com");
      driver.manage().window().maximize();
      Thread.sleep(2000);
      robot.setAutoDelay(50);
      robot.keyPress(KeyEvent.VK_F11);
      Thread.sleep(5000);
      driver.quit();
  }

But browser doesn't switch to full screen. Can someone suggest, how can I achieve that?

Alpha
  • 13,320
  • 27
  • 96
  • 163
  • The suggestions on this question may help: http://stackoverflow.com/questions/14951330/webdriver-open-browser-on-full-screen – DHall Jul 29 '14 at 17:12
  • No, that is not what I want. I want the full screen which is obtained by hitting F11 key on browser. – Alpha Jul 29 '14 at 17:49
  • I was referring to these 2 lines in one of the responses `((FirefoxDriver)driver).getKeyboard().pressKey(Keys.F11);` and `((JavascriptExecutor)driver).executeScript("window.focus()");` – DHall Jul 29 '14 at 19:07

0 Answers0