How to use the splinter.Browser function in splinter

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 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
github cobrateam / splinter / tests / test_flaskclient.py View on Github external
def setUpClass(cls):
        custom_headers = {
            "X-Splinter-Customheaders-1": "Hello",
            "X-Splinter-Customheaders-2": "Bye",
        }
        cls.browser = Browser("flask", app=app, custom_headers=custom_headers)
github CroceRossaItaliana / jorvik / base / utils_tests.py View on Github external
def crea_sessione(wait_time=5):
    from splinter import Browser
    browser = Browser(driver_name=SELENIUM_DRIVER, url=SELENIUM_URL,
                      browser=SELENIUM_BROWSER,
                      wait_time=wait_time)
    return browser
github cobrateam / splinter / tests / test_djangoclient.py View on Github external
def setUpClass(cls):
        components = parse.urlparse(EXAMPLE_APP)
        cls.browser = Browser('django', wait_time=0.1, client_SERVER_NAME=components.hostname,
                              client_SERVER_PORT=components.port)
github noahzn / WebZ / process.py View on Github external
def openpage(self, url) :
        import splinter
        import selenium
        browser = splinter.Browser('chrome')
        browser.driver.maximize_window()
        browser.visit(url)
        time.sleep(2)
        return browser
github ironman5366 / W.I.L.L / plugins / chromecast.py View on Github external
def netflix(sentence, args):
    netflix_config = config.load_config("netflix")
    if netflix_config:
        username = netflix_config['username']
        password = keyring.get_password("netflix", username)
        profile_name = netflix_config["profile_name"]
        if username and password:
            #TODO: change this to zope.testbrowser once it's working in the frontend
            chrome_path = config.load_config("chrome_path")
            executable_path = {'executable_path': chrome_path}
            browser = Browser("Chrome")
            browser.visit("https:///netflix.com/Login")
            email_field = browser.find_by_name("email")
            password_field = browser.find_by_name("password")
            sign_in_xpath = '//*[@id="appMountPoint"]/div/div[2]/div/form[1]/button'
            sign_in_button = browser.find_by_xpath(sign_in_xpath)
            email_field.fill(username)
            password_field.fill(password)
            sign_in_button.click()
            if browser.is_text_present(profile_name):
                profile_button = browser.find_by_text(profile_name)
                profile_button.click()
                #Use ent code to find out if there's a named work of art that was detected
                #search_tab_xpath = '//*[@id="hdPinTarget"]/div/div[1]/div/button'
                #search_tab_xpath = '//*[@id="hdPinTarget"]/div/div[1]/div/button/span[1]'
                search_tab_xpath = '//*[@id="hdPinTarget"]/div/div[1]/div/button'
                search_tab = browser.find_by_xpath(search_tab_xpath)
github anonymous247742 / TwitterReport / twitterReport.py View on Github external
sys.exit()
        elif opt in ("-i", "--file"):
            txt = arg
        elif opt in ("-u", "--user"):
            username = arg

    if not username and not txt:
        print 'Use --help for help\n'
        print 'Usage: python twitterReport.py -u  -i '
        print 'The accounts list must have only 1 account per line'
        sys.exit()

    password = getpass.getpass()

# comment this line if you want to use privoxy + tor:
    with Browser() as browser:
# uncomment this section if you want to use privoxy + tor:
#    proxyIP = '127.0.0.1'
#    proxyPort = 8118
#
#    proxy_settings = {'network.proxy.type': 1,
#            'network.proxy.http': proxyIP,
#            'network.proxy.http_port': proxyPort,
#            'network.proxy.ssl': proxyIP,
#            'network.proxy.ssl_port':proxyPort,
#            'network.proxy.socks': proxyIP,
#            'network.proxy.socks_port':proxyPort,
#            'network.proxy.ftp': proxyIP,
#            'network.proxy.ftp_port':proxyPort
#            }
#
#    with Browser('firefox',profile_preferences=proxy_settings) as browser:
github by-the-w3i / MSU_ROLL / source / main_app.py View on Github external
def authentication(self, ID, PW):
        try:
            b = Browser('chrome', headless=HEADLESS, **executable_path)
            URL = "https://schedule.msu.edu/Login.aspx"
            b.visit(URL)
            b.find_by_id("netid").fill(ID)
            b.find_by_id("pswd").fill(PW)
            b.find_by_value("Login").click()
            url = b.url
            b.quit()
            if url == "https://login.msu.edu/Login":
                return False
            return True
        except:
            # messagebox.showwarning(
            #     "System Error",
            #     "Error: chromedriver not found!!!"
            # )
            messagebox.showwarning(