tags:

views:

94

answers:

2

what is this command for?

+2  A: 

From the Selenium Documentation

windowFocus()

Gives focus to the currently selected window

AutomatedTester
+3  A: 

You might think that Selenium.selectWindow() would be all you need. But that simply tells Selenium which window you want all the Selenium commands to go to. One of the commands you can send to it is "give this (currently selected) window focus".

It's a bit confusing, because Windows (and other systems) sometimes refer to the "selected window" - the one that's on top of the others, or the "active" window. Here, we call it the window that "has focus". It's the window where keyboard events will be directed. Inside a window, individual widgets (text fields, scroll bars, buttons) can have focus too.

So windowFocus() is like clicking on the title bar of the window that Selenium is currently working with.

John