Good point. We can do it through raw JS. Although I've never been clear how
the multiple ways to set/unset events interact with each other in different
browsers. I'll investigate.


On 2 October 2013 04:50, Nicholas Pilon <notifications@github.com> wrote:

> In lettuce_webdriver/__init__.py:
>
> > +    driver.config = config
> > +    driver.requested_capabilities = caps
> > +
> > +    return driver
> > +
> > +
> > +@after.each_scenario  # pylint:disable=no-member
> > +def disable_beforeunload(scenario):
> > +    """
> > +    Disable before unload after a scenario so that the next scenario can
> > +    reload the site.
> > +    """
> > +
> > +    world.browser.execute_script("""
> > +try {
> > +    $(window).off('beforeunload');
>
> So, this depends on JQuery being installed in and exported by the target
> site. I'm not really comfortable making that a requirement for
> lettuce_webdriver; is there a better or easier way to do this?
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/bbangert/lettuce_webdriver/pull/36/files#r6695360>
> .
>