Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Selenium WebDriver - Disable Native Events (Enable Synthesized Events)

In Selenium (WebDriver), depending on OS, the Firefox Driver uses "native events" for user interaction simulation (keyboard, mouse, etc). It can also use "synthesized events", user interaction emulated via Javascript.

How do I disable native events, and enable synthesized events? (in Python)

like image 740
Corey Goldberg Avatar asked Oct 19 '13 21:10

Corey Goldberg


1 Answers

In a Firefox profile, you can set a preference or property like this (both have same effect):

profile.native_events_enabled = False

or...

profile.set_preference('webdriver_enable_native_events', False)

Example:

from selenium import webdriver

profile = webdriver.FirefoxProfile()
profile.native_events_enabled = False
driver = webdriver.Firefox(profile)
# synthesized events are now enabled for this 
# driver instance... native events are disabled.
...
like image 133
Corey Goldberg Avatar answered Oct 14 '22 09:10

Corey Goldberg