0

Using the following code to bring the window to focus, it works fine on Internet Explorer but isn't working with Firefox. Any suggestions would be highly appreciated.

((JavascriptExecutor)driver).executeScript("window.focus()");

Firefox version: 5.0.1
Webdriver version: 2.25
Anthony Grist
  • 38,173
  • 8
  • 62
  • 76
San
  • 227
  • 3
  • 10

1 Answers1

0

Firefox will only obey requests to raise a window if a security option is set, and it's not set by default.

The specific Firefox setting is in the "Tools" -> "Options" . There's a "Content" tabthre is is an "Advanced" button that brings up another dialog, wherein one finds a checkbox to allow (or disallow) the raising and lowering of windows by page code.

G . R
  • 543
  • 1
  • 6
  • 12
  • I tried that earlier based on the solution provided earlier in the following link, but it is not helping... http://stackoverflow.com/questions/4085544/why-window-focus-not-working-in-mozilla-firefox Following is my exact code driver = new FirefoxDriver(); augmentedDriver = new Augmenter().augment(driver); ((JavascriptExecutor)driver).executeScript("window.focus()"); – San Oct 29 '12 at 12:17
  • Do I have to do anything else since it is not helping pls suggest – San Oct 31 '12 at 05:57