mrd abd
mrd abd

Reputation: 858

Disable hardware inputs on Selenium webdriver firefox

I have a ruby script to test a web page in Firefox. it sends mouse or keyboard events pragmatically to Browser but when hardware mouse is moved, it affects my test.

How can i configure Firefox to forget hardware mouse and keyboard events?

Upvotes: 1

Views: 1224

Answers (2)

nettux
nettux

Reputation: 5406

You could use Xvfb which will provide a virtual screen for Firefox to open in. Basically you start Xvfb with a screen number in and point Firefox at that screen by running export DISPLAY=:XX. You could use PhantomJS but I wouldn't recommend it because it's doubtful that any users will ever use it; better to test with a browser that people use.

Info on setting up Xvfb

http://www.installationpage.com/selenium/how-to-run-selenium-headless-firefox-in-ubuntu/

How do I run Selenium in Xvfb?

Upvotes: 1

Mark Thomas
Mark Thomas

Reputation: 37527

I recommend the headless browser PhantomJS. It works with webdriver and pretty much all Ruby testing tools. Being headless, you must send mouse and keyboard events programmatically. The user's mouse and keyboard will have no effect.

You will also notice that the tests are faster!

Upvotes: 0

Related Questions