How to disable selenium from taking physical mouse on Chrome on user's machine on a different monitor screen?



  • My issue is related to this question Disable physical mouse and keyboard in selenium but I didn't see an answer for this question.

    tests are being ran by Java + Selenium + Chrome on the same user's machine (we don't have server to run the automation tests on, due to employer cost reasons). I have dual monitors so I ran the automation on one of the monitors, and tried to do something else on the other monitor but selenium kept taking away my physical mouse.

    Any help/guidance or info on how to resolve this issue is appreciated.


  • QA Engineer

    Selenium does not "take mouse from you" it can however switch focus to a browser window if certain conditions happens (usually when new tab opens). To avoid this i suggest you run your tests in headless mode. To run your tests in this mode you need to set chrome options as following:

      chromeOptions = new ChromeOptions();
      chromeOptions.addArguments("--headless");
    

    Of course this means you will not see the actual test being run in a browser window, instead a command line window will open, which you can minimize and continue your work.



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2