Skip to content

Commit

Permalink
Bump minimum splinter version to 0.13.0. (#142)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsfehler committed Sep 11, 2020
1 parent 9f473fc commit b437aab
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 33 deletions.
11 changes: 11 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
Changelog
=========


3.1.0
-----

- Remove unnecessary webdriver patch for retries, this behaviour is now part of splinter. (jsfehler)

3.0.0
-----

- Bump minimum splinter version to 0.13.0 (jsfehler)

2.1.0
-----

Expand Down
32 changes: 0 additions & 32 deletions pytest_splinter/webdriver_patches.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,52 +6,20 @@
"""

import time # pragma: no cover
import socket # pragma: no cover

try:
from httplib import HTTPException
except ImportError:
from http.client import HTTPException

import urllib3
from urllib3.exceptions import MaxRetryError

from selenium.webdriver.remote import remote_connection # pragma: no cover
from selenium.webdriver.firefox import webdriver # pragma: no cover
from selenium.webdriver.remote.webdriver import (
WebDriver as RemoteWebDriver,
) # pragma: no cover


# Get the original _request and store for future use in the monkey patched version as 'super'
old_request = remote_connection.RemoteConnection._request # pragma: no cover
# save the original execute
RemoteWebDriver._base_execute = RemoteWebDriver.execute # pragma: no cover


def patch_webdriver():
"""Patch selenium webdriver to add functionality/fix issues."""

def _request(self, *args, **kwargs):
"""Override _request to set socket timeout to some appropriate value."""
exception = HTTPException("Unable to get response")
for _ in range(3):
try:
return old_request(self, *args, **kwargs)
except (
socket.error,
HTTPException,
IOError,
OSError,
MaxRetryError,
) as exc:
exception = exc
self._conn = urllib3.PoolManager(timeout=self._timeout)
raise exception

# Apply the monkey patch for RemoteConnection
remote_connection.RemoteConnection._request = _request

# Apply the monkey patch to Firefox webdriver to disable native events
# to avoid click on wrong elements, totally unpredictable
# more info http://code.google.com/p/selenium/issues/detail?id=633
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
url='https://github.com/pytest-dev/pytest-splinter',
install_requires=[
'setuptools',
'splinter>=0.12.0',
'splinter>=0.13.0',
'selenium',
'pytest>=3.0.0',
'urllib3',
Expand Down

0 comments on commit b437aab

Please sign in to comment.