Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Removed methods to mute the webdriver log.

Related to #173.

Internally, splinter has a method to mute the webdriver log. This method
does not works on windows. I will remove it.
  • Loading branch information...
commit 55999c860af1e36e401190e5c865b6e896f6c203 1 parent 715ecf1
@andrewsmedina andrewsmedina authored
View
33 splinter/driver/webdriver/__init__.py
@@ -5,8 +5,6 @@
# license that can be found in the LICENSE file.
from __future__ import with_statement
-import logging
-import subprocess
import time
import re
from contextlib import contextmanager
@@ -17,44 +15,13 @@
from splinter.driver import DriverAPI, ElementAPI
from splinter.element_list import ElementList
from splinter.utils import warn_deprecated
-from tempfile import TemporaryFile
class BaseWebDriver(DriverAPI):
- old_popen = subprocess.Popen
def __init__(self, wait_time=2):
self.wait_time = wait_time
- def _patch_subprocess(self):
- loggers_to_silence = [
- 'selenium.webdriver.firefox.extension_connection',
- 'selenium.webdriver.remote.remote_connection',
- 'selenium.webdriver.remote.utils',
- ]
-
- class MutedHandler(logging.Handler):
- pass
-
- for name in loggers_to_silence:
- logger = logging.getLogger(name)
- logger.addHandler(MutedHandler())
- logger.setLevel(99999)
-
- # selenium is such a verbose guy let's make it open the
- # browser without showing all the meaningless output
- def MyPopen(*args, **kw):
- kw['stdout'] = TemporaryFile()
- kw['stderr'] = TemporaryFile()
- kw['close_fds'] = True
- return self.old_popen(*args, **kw)
-
- subprocess.Popen = MyPopen
-
- def _unpatch_subprocess(self):
- # cleaning up the house
- subprocess.Popen = self.old_popen
-
def __enter__(self):
return self
View
2  splinter/driver/webdriver/chrome.py
@@ -15,14 +15,12 @@ class WebDriver(BaseWebDriver):
driver_name = "Chrome"
def __init__(self, user_agent=None):
- self._patch_subprocess()
options = Options()
if user_agent is not None:
options.add_argument("--user-agent=" + user_agent)
self.driver = Chrome(chrome_options=options)
- self._unpatch_subprocess()
self.element_class = WebDriverElement
View
5 splinter/driver/webdriver/firefox.py
@@ -4,8 +4,6 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-import subprocess
-
from selenium.webdriver import Firefox
from selenium.webdriver.firefox.firefox_profile import FirefoxProfile
from splinter.driver.webdriver import BaseWebDriver, WebDriverElement as BaseWebDriverElement
@@ -17,7 +15,6 @@ class WebDriver(BaseWebDriver):
driver_name = "Firefox"
def __init__(self, profile=None, extensions=None, user_agent=None, profile_preferences=None):
- self.old_popen = subprocess.Popen
firefox_profile = FirefoxProfile(profile)
firefox_profile.set_preference('extensions.logging.enabled', False)
firefox_profile.set_preference('network.dns.disableIPv6', False)
@@ -33,9 +30,7 @@ def __init__(self, profile=None, extensions=None, user_agent=None, profile_prefe
for extension in extensions:
firefox_profile.add_extension(extension)
- self._patch_subprocess()
self.driver = Firefox(firefox_profile)
- self._unpatch_subprocess()
self.element_class = WebDriverElement
Please sign in to comment.
Something went wrong with that request. Please try again.