Skip to content

Commit 0f9cae6

Browse files
committed
Fix mouse_over patch for recent splinter (0.18.1)
1 parent 95b1dcb commit 0f9cae6

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

CHANGES.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
Changelog
22
=========
33

4+
3.3.2
5+
------
6+
7+
- Fix mouse_over patch for Firefox, so it works with recent splinter (0.18.1) (mpasternak),
8+
9+
410
3.3.1
511
-----
612

pytest_splinter/splinter_patches.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""Patches for splinter."""
22
from functools import partial
33

4-
from splinter.driver.webdriver import firefox
4+
from splinter.driver import webdriver
55

66
from selenium.webdriver.common.action_chains import ActionChains # pragma: no cover
77

@@ -18,4 +18,12 @@ def mouse_over(self):
1818
)
1919

2020
# Apply the monkey patch for Firefox WebDriverElement
21-
firefox.WebDriverElement.mouse_over = mouse_over
21+
try:
22+
webdriver.firefox.WebDriverElement.mouse_over = mouse_over
23+
except AttributeError:
24+
# With splinter 0.18.1 it could be made easier, as the web_element_class
25+
# is in the initializer, but ATM it is not, so we should patch it
26+
# globally. Will it hurt in the long run? The function is pretty similar
27+
# to the one in splinter... as long as the element we try to mouse_over
28+
# is at least 2 pixels wide...
29+
webdriver.WebDriverElement.mouse_over = mouse_over

0 commit comments

Comments
 (0)