本文整理汇总了Python中splinter.Browser方法的典型用法代码示例。如果您正苦于以下问题:Python splinter.Browser方法的具体用法?Python splinter.Browser怎么用?Python splinter.Browser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类splinter
的用法示例。
在下文中一共展示了splinter.Browser方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_login
# 需要导入模块: import splinter [as 别名]
# 或者: from splinter import Browser [as 别名]
def test_login(self):
"""Test logging in `testrp` using OIDC"""
browser = Browser(self.webdriver, headless=True)
# Check that user is not logged in
browser.visit('http://testrp:8081')
self.assertTrue(browser.is_text_not_present('Current user:'))
# Perform login
self.perform_login(browser)
# Accept scope
browser.find_by_css('input[name="allow"]').click()
# Check that user is now logged in
self.assertTrue(browser.is_text_present('Current user:'))
示例2: test_logout
# 需要导入模块: import splinter [as 别名]
# 或者: from splinter import Browser [as 别名]
def test_logout(self):
"""Test logout functionality of OIDC lib"""
browser = Browser(self.webdriver, headless=True)
# Check that user is not logged in
browser.visit('http://testrp:8081')
self.assertTrue(browser.is_text_not_present('Current user:'))
self.perform_login(browser)
# Accept scope
browser.find_by_css('input[name="allow"]').click()
# Check that user is now logged in
self.assertTrue(browser.is_text_present('Current user:'))
self.perform_logout(browser)
# Check that user is now logged out
self.assertTrue(browser.is_text_not_present('Current user:'))
示例3: __init__
# 需要导入模块: import splinter [as 别名]
# 或者: from splinter import Browser [as 别名]
def __init__(self):
"""Initiate object with default encoding and other required data."""
# Expect some weird characters from fuzz lists, make encoding UTF-8
reload(sys)
sys.setdefaultencoding('utf8')
# All potential XSS findings
self.xss_links = []
# Fuzzy string matching partials list
self.xss_partials = []
# Keep index of screens for log files
self.screen_index = ""
# Get user args and store
self.user_args = self.parse_args()
# PhantomJS browser
self.browser = Browser("phantomjs")
示例4: __init__
# 需要导入模块: import splinter [as 别名]
# 或者: from splinter import Browser [as 别名]
def __init__(self):
self.captcha_element = None
self.browser = splinter.Browser()
self.neural_net = nn.NeuralNetwork(weights_file=config['weights_path'])
self.num_correct = 0
self.num_guesses = 0
self.old_captcha_urls = []
示例5: __init__
# 需要导入模块: import splinter [as 别名]
# 或者: from splinter import Browser [as 别名]
def __init__(self):
self.db = database.match_database()
self.db.remove_old_matches()
self.br = splinter.Browser('chrome')
示例6: browser
# 需要导入模块: import splinter [as 别名]
# 或者: from splinter import Browser [as 别名]
def browser():
from splinter import Browser
return Browser('django')
示例7: setUp
# 需要导入模块: import splinter [as 别名]
# 或者: from splinter import Browser [as 别名]
def setUp(self):
"""Create test account in `testprovider` instance"""
with Browser(self.webdriver, headless=True) as browser:
browser.visit('http://testprovider:8080/account/signup')
browser.find_by_css('#id_username').fill(self.account['username'])
browser.find_by_css('#id_password').fill(self.account['password'])
browser.find_by_css('#id_password_confirm').fill(self.account['password'])
browser.find_by_css('#id_email').fill(self.account['email'])
browser.find_by_css('.btn-primary').click()
示例8: tearDown
# 需要导入模块: import splinter [as 别名]
# 或者: from splinter import Browser [as 别名]
def tearDown(self):
"""Remove test account from `testprovider` instance"""
with Browser(self.webdriver, headless=True) as browser:
self.perform_login(browser)
browser.visit('http://testprovider:8080/account/delete')
browser.find_by_css('.btn-danger').click()
示例9: __init__
# 需要导入模块: import splinter [as 别名]
# 或者: from splinter import Browser [as 别名]
def __init__(self, un, pw):
self.username = un;
self.password = pw;
self.currentPage = 0;
self.messageID = 0;
self.browser = Browser("phantomjs");
pass;
示例10: get_claim_code_from_server
# 需要导入模块: import splinter [as 别名]
# 或者: from splinter import Browser [as 别名]
def get_claim_code_from_server():
browser = Browser('phantomjs', service_args=['--ignore-ssl-errors=true'])
browser.visit(ROOT_ADDRESS + "/merchant-login")
browser.fill_form({"email": USER_NAME, "password": PASSWORD})
browser.find_by_id("loginButton")[0].click()
time.sleep(5)
browser.visit(ROOT_ADDRESS + "/api-tokens")
browser.find_by_css(".token-access-new-button").find_by_css(".btn").find_by_css(".icon-plus")[0].click()
browser.find_by_id("token-new-form").find_by_css(".btn")[0].click()
return browser.find_by_css(".token-claimcode")[0].html
示例11: crea_sessione
# 需要导入模块: import splinter [as 别名]
# 或者: from splinter import Browser [as 别名]
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