Multiple Instances of Firefox during Selenium Webdriver Testing not handling focus correctly.

后端 未结 3 1026
春和景丽
春和景丽 2020-12-19 05:21

I have noticed that while running multiple selenium firefox tests in parallel on a grid that the focus event handling is not working correctly. I have confirmed that when ea

3条回答
  •  星月不相逢
    2020-12-19 05:59

    @djangofan: Wrong. You cannot lock the focus. After you requested focus in one window and before you trigger an action, another window requests focus, and your action (like sending keys to input field) just doesn't work. This happened in our tests several times daily. It was hard to reproduce, because with each test run it failed on different places. A solution is to execute each browser in a separate display. E.g. you can use Xvfb:

      Xvfb ... -screen 1 1200x800x24 -screen 2 1200x800x24 ...
    

    Then when you start a browser, assign a separate screen to it:

      browser.setEnvironmentProperty("DISPLAY", ":N.1");
      browser.setEnvironmentProperty("DISPLAY", ":N.2");
      ...
    

提交回复
热议问题