Skip to content
This repository has been archived by the owner on Feb 8, 2018. It is now read-only.

Commit

Permalink
Merge pull request #4614 from gratipay/selenium-workaround
Browse files Browse the repository at this point in the history
Work around bug in Selenium 3.4.3 + Chrome 60
  • Loading branch information
chadwhitacre authored Sep 10, 2017
2 parents 91d9ddc + f25adf6 commit 0cd62cc
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions gratipay/testing/browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
import time

from splinter.browser import _DRIVERS
from splinter.driver.webdriver import WebDriverElement
from selenium.common.exceptions import WebDriverException
from selenium.webdriver.common.keys import Keys

from gratipay.security import user

Expand All @@ -22,6 +25,17 @@ class NeverLeft(Exception): pass
class NeverShowedUp(Exception): pass


# Monkey-patch .click to work around stackoverflow.com/q/11908249
def monkey_click(self):
try:
self._element.click() # Firefox 55
except WebDriverException as exc:
if not exc.msg.startswith('unknown error: Element is not clickable'):
raise
self._element.send_keys(Keys.RETURN) # Chrome 60
WebDriverElement.click = monkey_click


class BrowserHarness(Harness):
"""This is a harness for through-the-web (TTW) testing. It passes
everything through to an underlying `Splinter`_ browser, with the following
Expand Down

0 comments on commit 0cd62cc

Please sign in to comment.