selenium webdriver - trigger event on element via jQuery

The 'executeScript' method of the webdriver receives additional 'arguments' variable and we can pass WebElement instances to the script. So trigger an event on the elemen can be done like this (python):

event = 'click' #or 'hover' or any other
script = "$(arguments[0]).trigger('"+event+"')"
webdriver.execute_script(script, web_element)

Stackoverflow question

profile for Boris Serebrov on Stack Exchange, a network of free, community-driven Q&A sites