1

I am trying to run an automated test that requires me to move the mouse around the page.

The problem is that whenever the person running the test moves the physical mouse while the test is running, it interferes with the mouse movements I am trying to do within Selenium+Chrome.

Is there a way to tell selenium to disable the physical mouse and / or the physical keyboard interactions while running a test?

By the way, tests are being ran by Java + Selenium + Chrome

Just to clarify, running this on a separate, dedicated machine without human intervention is not an option. This is something that is required to run on a machine that is being used for other purposes by a human (or any other species that can move a mouse!). Headless will probably be the way to go in the future, but not at the moment.

4
  • Why is it required to run tests on the machine used by other people at the same time? What scenario are you trying to simulate?
    – dzieciou
    Commented Jul 24, 2019 at 19:41
  • 1
    @dzieciou I don't see how the scenario matters, but there is a web tool for generating tests, and the person who generates the test presses a button to see it running in his/her machine. Regardless of the scenario, the requirement is that it cannot run on a separate machine. Given that fact, I need to know if there is a way to tell selenium to ignore external, physical devices while running a test. Commented Jul 25, 2019 at 8:14
  • @BlunT: was you able to figure it out? I have the same issue which leads me to your question.
    – Kim Nguyen
    Commented Jan 31, 2020 at 16:30
  • No, I haven't been able to find a solution. Commented Jan 31, 2020 at 17:37

2 Answers 2

4

You should not be running tests on a machine used by user(s). Set up a dedicated computer or VM for testing and and use headless browser mode (more info here and here).

1
  • Appreciate the info, but that is not a viable option. I will update the question to clear that out. Commented Jul 24, 2019 at 17:13
0

So, there's 2 possible scenario's here

1) test is running while someone else is supposed to be using the computer.

With any normal scenario, too bad, you're pretty much out of luck, as the browser will always need to take focus, unless you run chrome in headless mode, which can also cause some problems. Are these development machines? Or for the development team? Maybe consider running it in a container.

2) The computer is a shared machine, some people occasionally use the computer while the test is running.

Maybe look at a hardware solution like a KVM switch. People will be required to press a button/switch, and make them think about actually doing something.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.