Ejemplo n.º 1
0
 def test_should_deprecate_with_the_given_message(self):
     with warnings.catch_warnings(record=True) as warnings_list:
         warnings.simplefilter('default')
         cls = deprecate_driver_class(self.Foo, message="Foo was deprecated")
         cls()
         warning = warnings_list[0]
         assert type(warning.message) is DeprecationWarning
         self.assertEquals("Foo was deprecated", warning.message.args[0])
Ejemplo n.º 2
0
 def test_should_prepend_a_Deprecated_to_class(self):
     with warnings.catch_warnings(record=True):
         warnings.simplefilter('default')
         cls = deprecate_driver_class(
             self.Foo,
             message="Foo was deprecated"
         )
         self.assertEqual("DeprecatedFoo", cls.__name__)
Ejemplo n.º 3
0
 def test_should_deprecate_with_the_given_message(self):
     with warnings.catch_warnings(record=True) as warnings_list:
         warnings.simplefilter('default')
         cls = deprecate_driver_class(self.Foo, message="Foo was deprecated")
         cls()
         warning = warnings_list[0]
         assert type(warning.message) is DeprecationWarning
         self.assertEquals("Foo was deprecated", warning.message.args[0])
Ejemplo n.º 4
0
# -*- coding: utf-8 -*-
from splinter.driver.webdriver.firefox import WebDriver as FirefoxWebDriver
from splinter.driver.webdriver.chrome import WebDriver as ChromeWebDriver
from splinter.exceptions import DriverNotFoundError
from splinter.utils import deprecate_driver_class


_DRIVERS = {
    'firefox': FirefoxWebDriver,
    'chrome': ChromeWebDriver,
    'webdriver.chrome': deprecate_driver_class(ChromeWebDriver, message="'webdriver.chrome' is deprecated, use just 'chrome'"),
    'webdriver.firefox': deprecate_driver_class(FirefoxWebDriver, message="'webdriver.firefox' is deprecated, use just 'firefox'"),
}

try:
    from splinter.driver.zopetestbrowser import ZopeTestBrowser
    _DRIVERS['zope.testbrowser'] = ZopeTestBrowser
except ImportError:
    pass


def Browser(driver_name='firefox', *args, **kwargs):
    """
    Returns a driver instance for the given name.

    When working with ``firefox``, it's possible to provide a profile name and a
    list of extensions.

    If you don't provide any driver_name, then ``firefox`` will be used.

    If there is no driver registered with the provided ``driver_name``, this function
Ejemplo n.º 5
0
 def test_should_prepend_a_Deprecated_to_class(self):
     with warnings.catch_warnings(record=True):
         warnings.simplefilter('default')
         cls = deprecate_driver_class(self.Foo,
                                      message="Foo was deprecated")
         self.assertEqual("DeprecatedFoo", cls.__name__)