0

I am developing a Firefox extension and have a need to generate synthetic events. I want this events to be treated as 'native' events. However, the DOM APIs exposed by Firefox (createEvent, initEvent) aren't really behaving as native events. I realized Selenium solved the issue by adopting native events.

My question is, can I use webdriver.xpi standalone within my extension? My extension is JavaScript based. If yes, how? Has anyone done it before?

Any pointers will be highly appreciated.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Sunil Agrawal
  • 679
  • 4
  • 14
  • possible duplicate of [Are events generated by Firefox extension 'trusted'?](http://stackoverflow.com/questions/11456705/are-events-generated-by-firefox-extension-trusted) – Wladimir Palant Jul 12 '12 at 22:12
  • Agreed. My question here is a bit different, but the answer for the other question solves the problem I was trying to solve using Selenium's webdriver.xpi. – Sunil Agrawal Aug 06 '12 at 17:38

1 Answers1

0

Selenium is unnecessary:

You can use nsIDOMWindowUtils.sendMouseEventToWindow() instead of document.createEvent(). This method is meant for testing and will generate a native event as well.

References

Community
  • 1
  • 1
Paul Sweatte
  • 24,148
  • 7
  • 127
  • 265