Skip to content

Commit

Permalink
Fix Firefox to be more reliable on versions over 45
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
psav committed Jul 4, 2018
1 parent f9f952a commit 872a8a8
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/widgetastic/browser.py
Expand Up @@ -4,7 +4,6 @@
import inspect
import six
import time

from cached_property import cached_property
from collections import namedtuple
from jsmin import jsmin
Expand All @@ -23,9 +22,8 @@
StaleElementReferenceException, NoAlertPresentException, LocatorNotImplemented,
WebDriverException)
from .log import create_widget_logger, null_logger
from .xpath import normalize_space
from .utils import crop_string_middle

from .xpath import normalize_space

Size = namedtuple('Size', ['width', 'height'])
Location = namedtuple('Location', ['x', 'y'])
Expand Down Expand Up @@ -351,10 +349,15 @@ def click(self, locator, *args, **kwargs):
"""
self.logger.debug('click: %r', locator)
ignore_ajax = kwargs.pop('ignore_ajax', False)
nav_click = kwargs.pop('nav_click', False)
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()
Expand Down

0 comments on commit 872a8a8

Please sign in to comment.