How to use splinter - 10 common examples

To help you get started, we’ve selected a few splinter examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cobrateam / splinter / tests / test_djangoclient.py View on Github external
def test_forward_to_none_page(self):
        "should not fail when trying to forward to none"
        browser = Browser('django')
        browser.visit(EXAMPLE_APP)
        browser.forward()
        self.assertEqual(EXAMPLE_APP, browser.url)
        browser.quit()
github cobrateam / splinter / tests / unit / test_api_browser.py View on Github external
def test_quit(self):
        "Browser.quit should call driver.quit"
        with Mock() as mock:
            mock.quit()
        with Stub() as browser:
            from splinter.driver import WebDriver
            WebDriver() >> mock
        browser = Browser()
        browser.quit()

        WebDriver.restore_import()
        mock.validate()
github cobrateam / splinter / tests / test_request_handler.py View on Github external
def test_should_get_an_exception_and_format_it(self):
        request = RequestHandler()
        request.connect(EXAMPLE_APP + "page-that-doesnt-exists")
        try:
            request.ensure_success_response()
        except HttpResponseError as e:
            exception = e.msg
        self.assertEqual("404 - Not Found", exception)
github cobrateam / splinter / tests / unit / test_api_browser.py View on Github external
def test_visit(self):
        "Browser.visit should call driver.visit"

        with Mock() as mock:
            mock.visit('http://foo.com')
        with Stub() as browser:
            from splinter.driver import WebDriver
            WebDriver() >> mock
        browser = Browser()
        browser.visit('http://foo.com')

        WebDriver.restore_import()
        mock.validate()
github cobrateam / splinter / tests / unit / test_api_browser.py View on Github external
def test_quit(self):
        "Browser.quit should call driver.quit"
        with Mock() as mock:
            mock.quit()
        with Stub() as browser:
            from splinter.driver import WebDriver
            WebDriver() >> mock
        browser = Browser()
        browser.quit()

        WebDriver.restore_import()
        mock.validate()
github cobrateam / splinter / tests / unit / test_api_webdriver.py View on Github external
def test_visit(self):
        "WebDriver.visit should call browser.get"

        with Mock() as firefox_mock:
            firefox_mock.get('http://foo.com')

        with ReplaceBrowser(firefox_mock):
            driver = WebDriver()
            driver.visit('http://foo.com')

        firefox_mock.validate()
github cobrateam / splinter / tests / unit / test_api_browser.py View on Github external
def test_quit(self):
        "Browser.quit should call driver.quit"
        with Mock() as mock:
            mock.quit()
        with Stub() as browser:
            from splinter.driver import WebDriver
            WebDriver() >> mock
        browser = Browser()
        browser.quit()

        WebDriver.restore_import()
        mock.validate()
github cobrateam / splinter / tests / unit / test_api_webdriver.py View on Github external
def test_quit(self):
        "WebDriver.quit should call browser.quit"

        with Mock() as firefox_mock:
            firefox_mock.quit()

        with ReplaceBrowser(firefox_mock):
            driver = WebDriver()
            driver.quit()

        firefox_mock.validate()
github 20tab / django-uwsgi-template-legacy / tests / bdd / environment.py View on Github external
settings, 'BDD_BROWSER_LANGUAGE', 'en-US'
        )
    }
    if driver_name == 'firefox':
        params.update({
            'profile_preferences': language,
            'capabilities': {'moz:webdriverClick': False},
        })
    elif driver_name == 'chrome':
        load_entry_point('chromedriver-binary==74.0.3729.6.0', 'console_scripts', 'chromedriver-path')
        options = Options()
        options.add_experimental_option('prefs', language)
        params.update({
            'options': options
        })
    context.browser = Browser(**params)
github haiwen / seahub / tests / ui / driver.py View on Github external
def __init__(self, start_url):
        imp = os.environ.get('WEBDRIVER', 'firfox')
        if imp in ('firefox', 'ff'):
            driver = 'firefox'
        else:
            driver = 'phantomjs'
        self.b = splinter.Browser(driver)
        self.d = self.b.driver
        self.d.set_window_size(1400, 1000)
        self.start_url = start_url