def submit_form(element):
    """Form submission work-around

    See https://github.com/SeleniumHQ/selenium/issues/3483 for details"""
    if element._w3c:
        form = element.find_element_by_xpath('./ancestor-or-self::form')
        element._parent.execute_script(
            "var e = arguments[0].ownerDocument.createEvent('Event');e.initEvent('submit', true, true);arguments[0].dispatchEvent(e);"
            , form)
    else:
        element.submit()
