Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Selenium open browser and set focus

I am having trouble, running selenium tests for my web gui ,sometimes when the test starts the browser open but the focus is still on the eclipse(I see eclipse window rather than browser ) which then throws errors like "Button could not be found" or link not found.

Does anyone have idea how to set focus on opened browser whenever the selenium test starts ?

like image 510
Makky Avatar asked Nov 17 '25 01:11

Makky


1 Answers

It doesn't matter if the browser is focused or not. The errors most likely occur because of another circumstance.

Which Version of Selenium do you use?

If you are not already using Webdriver(Selenium 2), I would suggest switching to it.

With Webdriver 2 you can also use

windowFocus() 
like image 87
arket Avatar answered Nov 19 '25 15:11

arket