From 2b2c02611225af8069ca413a627e3d41fd488d90 Mon Sep 17 00:00:00 2001 From: Pete Savage Date: Wed, 4 Jul 2018 10:03:33 +0100 Subject: [PATCH] Fix Firefox to be more reliable on versions over 45 * Firefox behaves differently between an ActionChains click and a "real" click. The ActionChains click does not try to wait for page navigation as such, navigations often fail because the page is changed from under it. * We now use a "real" click if a navigation has been requested. This now also initiates a sleep for 1s immediately after we instruct marionette to click. This is then enough time for any CSS animations to finish up before we continue running any more selenium methods to check for page objects to be displayed. --- src/widgetastic/browser.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/widgetastic/browser.py b/src/widgetastic/browser.py index 4856e88e..5227d5a9 100644 --- a/src/widgetastic/browser.py +++ b/src/widgetastic/browser.py @@ -354,7 +354,11 @@ def click(self, locator, *args, **kwargs): el = self.move_to_element(locator, *args, **kwargs) self.plugin.before_click(el) # and then click on current mouse position - self.perform_click() + if nav_click and self.browser_type.lower() == 'firefox' and self.browser_version > 52: + el.click() + time.sleep(1) + else: + self.perform_click() if not ignore_ajax: try: self.plugin.ensure_page_safe()