Selenium Chrome window running in second monitor screen stealing focus

前端 未结 4 1372
感动是毒
感动是毒 2021-01-01 23:00

I use WebDriver with Chrome Driver 2.35 with Selenium.

I have a dual monitor setup in which I run my test cases. I do run my cases headlessly most of the times but

4条回答
  •  粉色の甜心
    2021-01-01 23:12

    Selenium chromedriver does steal the focus only once at startup. Afterwards you can run the browser in the background without any problems (we're doing it that way, using chromedriver 2.30, so I'm sure it works)

    Therefore you probably have some code in your web tests which performs the focus stealing:

    1) Changing the active window or opening a new window / new tab causes focus stealing.

    2) You explicitly call Focus() on an element.

    Are you sure your code is free of such calls?

提交回复
热议问题