Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make sure that browser opened by webdriver is always in focus

If the browser window is not in focus, all webdriver identifications on the current page fail.

How can the browser be brought into focus, using webdriver?

like image 212
user1402913 Avatar asked May 18 '12 08:05

user1402913


1 Answers

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

should do the trick!

like image 88
Ashwin Prabhu Avatar answered Jan 02 '23 21:01

Ashwin Prabhu