本文整理汇总了Python中splinter.Browser.type方法的典型用法代码示例。如果您正苦于以下问题:Python Browser.type方法的具体用法?Python Browser.type怎么用?Python Browser.type使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类splinter.Browser
的用法示例。
在下文中一共展示了Browser.type方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: PlayPagesWebTests
# 需要导入模块: from splinter import Browser [as 别名]
# 或者: from splinter.Browser import type [as 别名]
class PlayPagesWebTests(StaticLiveServerTestCase):
def setUp(self):
self.user1 = UserFactory.build()
self.user1.set_password('abc')
self.user1.save()
self.user2 = UserFactory.build()
self.user2.set_password('123')
self.user2.save()
self.browser1 = Browser()
def tearDown(self):
self.browser1.quit()
def login_helper(self, browser, username, password):
browser.visit(
'%s%s' % (self.live_server_url, '/accounts/login/')
)
browser.fill('username', username)
browser.fill('password', password)
browser.find_by_value('Log in').first.click()
# Test 4
# Check playing single player game
def test_single_player(self):
self.login_helper(self.browser1, self.user1.username, 'abc')
self.browser1.visit(
'%s%s' % (self.live_server_url, '/play/')
)
time.sleep(2)
snippet = self.browser1.find_by_id('type').value
try:
snippet = snippet[:-(
len(snippet.split()[-1]) + 1
)]
for c in snippet[:100]:
self.browser1.type('typed', c)
time.sleep(0.001)
self.browser1.find_by_tag('input')[3].click()
self.browser1.find_by_tag('input').last.click()
self.assertEqual(
self.browser1.url,
'%s%s' % (self.live_server_url, '/scores/')
)
except ElementNotVisibleException:
self.assertTrue(True)
示例2:
# 需要导入模块: from splinter import Browser [as 别名]
# 或者: from splinter.Browser import type [as 别名]
if conIndex == 0:
companyName = devdCompanyNameList[cType]
else:
companyName = devgCompanyNameList[cType]
typeaName = typeaNameList[cType]
if cType == 0 or cType == 1:
# pass
for igType in igTypeListScotia:
# fdsf
browser.find_by_name('addScenario').first.click()
browser.fill('scName', countryTypeList[conIndex]+typeaName+igType)
browser.type('scEffDate', '\b\b\b\b\b\b\b\b\b\b')
browser.type('scEffDate', '2015-10-31')
browser.find_by_name('update').first.click()
browser.find_link_by_text('Obligor').first.click()
# choose the companyType type
element = browser.find_by_name('companyType').first
element.select(str(cType))
browser.fill('obligorName', companyName)
browser.find_by_name('ObligorSearch').first.click()
browser.find_link_by_partial_href('javascript:refPortResult')[0].click()
# select "B-III counterpaty type" to be "corporate"
示例3:
# 需要导入模块: from splinter import Browser [as 别名]
# 或者: from splinter.Browser import type [as 别名]
# browser.driver.save_screenshot(typeaName + countryList[conIndex] + '_' + igArray[x] +'.png')
# browser.find_link_by_partial_href('/CNETCORP/cpmScenarios.do').first.click()
else:
# create the new scenario
if cType == 0:
typeaName = 'Existing_Scotia_Public_'
elif cType == 1:
typeaName = 'Existing_Scotia_Private_'
else:
typeaName = 'Non_Scotia_Public_'
browser.find_by_name('addScenario').first.click()
browser.fill('scName', typeaName + countryList[conIndex])
browser.type('scEffDate', '\b\b\b\b\b\b\b\b\b\b')
browser.type('scEffDate', '2014-10-31')
browser.find_by_name('update').first.click()
browser.find_link_by_text('Obligor').first.click()
# choose the companyType type
element = browser.find_by_name('companyType').first
element.select(str(cType))
# fill a key word for the couterpayname and search
browser.fill('obligorName', countryList[conIndex])
browser.find_by_name('ObligorSearch').first.click()
# if counterparty type is public choose a company from the first table, otherwise from the second table
if cType == 0 or cType == 1: