本文整理汇总了Python中selenium.webdriver.common.keys.Keys.BACK_SPACE属性的典型用法代码示例。如果您正苦于以下问题:Python Keys.BACK_SPACE属性的具体用法?Python Keys.BACK_SPACE怎么用?Python Keys.BACK_SPACE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类selenium.webdriver.common.keys.Keys
的用法示例。
在下文中一共展示了Keys.BACK_SPACE属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: populate_lookup_field
# 需要导入模块: from selenium.webdriver.common.keys import Keys [as 别名]
# 或者: from selenium.webdriver.common.keys.Keys import BACK_SPACE [as 别名]
def populate_lookup_field(self, name, value):
"""Enters a value into a lookup field.
"""
input_locator = self._get_input_field_locator(name)
menu_locator = lex_locators["object"]["field_lookup_link"].format(value)
self._populate_field(input_locator, value)
for x in range(3):
self.wait_for_aura()
try:
self.selenium.get_webelement(menu_locator)
except ElementNotFound:
# Give indexing a chance to catch up
time.sleep(2)
field = self.selenium.get_webelement(input_locator)
field.send_keys(Keys.BACK_SPACE)
else:
break
self.selenium.set_focus_to_element(menu_locator)
self._jsclick(menu_locator)
示例2: test_integer_buckets_total_open
# 需要导入模块: from selenium.webdriver.common.keys import Keys [as 别名]
# 或者: from selenium.webdriver.common.keys.Keys import BACK_SPACE [as 别名]
def test_integer_buckets_total_open(self):
survey_id = self.survey_with_branch('integer', '(,)')
self.get('/enumerate/{}'.format(survey_id))
self.wait_for_element('navigate-right', By.CLASS_NAME)
self.click(self.drv.find_element_by_class_name('navigate-right'))
(
self.drv
.find_element_by_tag_name('input')
.send_keys('-999')
)
self.click(self.drv.find_element_by_class_name('navigate-right'))
self.assertEqual(
self.drv.find_element_by_tag_name('h3').text,
'b0'
)
self.click(self.drv.find_element_by_class_name('page_nav__prev'))
self.input_field().send_keys(Keys.BACK_SPACE * 4, '999')
self.click(self.drv.find_element_by_class_name('navigate-right'))
self.assertEqual(
self.drv.find_element_by_tag_name('h3').text,
'b0'
)
示例3: test_decimal_buckets_total_open
# 需要导入模块: from selenium.webdriver.common.keys import Keys [as 别名]
# 或者: from selenium.webdriver.common.keys.Keys import BACK_SPACE [as 别名]
def test_decimal_buckets_total_open(self):
survey_id = self.survey_with_branch('decimal', '(,)')
self.get('/enumerate/{}'.format(survey_id))
self.wait_for_element('navigate-right', By.CLASS_NAME)
self.click(self.drv.find_element_by_class_name('navigate-right'))
(
self.drv
.find_element_by_tag_name('input')
.send_keys('-999.1')
)
self.click(self.drv.find_element_by_class_name('navigate-right'))
self.assertEqual(
self.drv.find_element_by_tag_name('h3').text,
'b0'
)
self.click(self.drv.find_element_by_class_name('page_nav__prev'))
self.input_field().send_keys(Keys.BACK_SPACE * 6, '999.1')
self.click(self.drv.find_element_by_class_name('navigate-right'))
self.assertEqual(
self.drv.find_element_by_tag_name('h3').text,
'b0'
)
示例4: login
# 需要导入模块: from selenium.webdriver.common.keys import Keys [as 别名]
# 或者: from selenium.webdriver.common.keys.Keys import BACK_SPACE [as 别名]
def login(self):
if self.logged_in:
return
logger.info('Initiating log in')
url = "https://onlinebanking.usbank.com/Auth/Login"
self.driver.get(url)
(username, password), = self.wait_and_return(
self.find_username_and_password_in_any_frame)
logger.info('Entering username and password')
# In case of autofill
for i in range(50):
username.send_keys(Keys.BACK_SPACE)
password.send_keys(Keys.BACK_SPACE)
username.send_keys(self.credentials['username'])
password.send_keys(self.credentials['password'])
with self.wait_for_page_load(timeout = 30):
password.send_keys(Keys.ENTER)
logger.info('Logged in')
self.logged_in = True
示例5: login
# 需要导入模块: from selenium.webdriver.common.keys import Keys [as 别名]
# 或者: from selenium.webdriver.common.keys.Keys import BACK_SPACE [as 别名]
def login(self):
if self.logged_in:
return
logger.info('Initiating log in')
url = "https://banking.radiusbank.com/login"
self.driver.get(url)
(username, password), = self.wait_and_return(
self.find_username_and_password_in_any_frame)
logger.info('Entering username and password')
# In case of autofill
for i in range(50):
username.send_keys(Keys.BACK_SPACE)
password.send_keys(Keys.BACK_SPACE)
username.send_keys(self.credentials['username'])
password.send_keys(self.credentials['password'])
with self.wait_for_page_load(timeout = 30):
password.send_keys(Keys.ENTER)
logger.info('Logged in')
self.logged_in = True
示例6: test_integer_buckets
# 需要导入模块: from selenium.webdriver.common.keys import Keys [as 别名]
# 或者: from selenium.webdriver.common.keys.Keys import BACK_SPACE [as 别名]
def test_integer_buckets(self):
survey_id = self.survey_with_branch('integer', '(1, 3)', '[4, 5]')
self.get('/enumerate/{}'.format(survey_id))
self.wait_for_element('navigate-right', By.CLASS_NAME)
self.click(self.drv.find_element_by_class_name('navigate-right'))
(
self.drv
.find_element_by_tag_name('input')
.send_keys('2')
)
self.click(self.drv.find_element_by_class_name('navigate-right'))
self.assertEqual(
self.drv.find_element_by_tag_name('h3').text,
'b0'
)
self.click(self.drv.find_element_by_class_name('page_nav__prev'))
self.input_field().send_keys(Keys.BACK_SPACE, '4')
self.click(self.drv.find_element_by_class_name('navigate-right'))
self.assertEqual(
self.drv.find_element_by_tag_name('h3').text,
'b1'
)
self.click(self.drv.find_element_by_class_name('page_nav__prev'))
self.input_field().send_keys(Keys.BACK_SPACE, '1')
self.click(self.drv.find_element_by_class_name('navigate-right'))
self.assertEqual(
self.drv.find_element_by_tag_name('h3').text,
'last question'
)
示例7: test_integer_buckets_open_ranges
# 需要导入模块: from selenium.webdriver.common.keys import Keys [as 别名]
# 或者: from selenium.webdriver.common.keys.Keys import BACK_SPACE [as 别名]
def test_integer_buckets_open_ranges(self):
survey_id = self.survey_with_branch('integer', '(, 0)', '[10,)')
self.get('/enumerate/{}'.format(survey_id))
self.wait_for_element('navigate-right', By.CLASS_NAME)
self.click(self.drv.find_element_by_class_name('navigate-right'))
(
self.drv
.find_element_by_tag_name('input')
.send_keys('-5')
)
self.click(self.drv.find_element_by_class_name('navigate-right'))
self.assertEqual(
self.drv.find_element_by_tag_name('h3').text,
'b0'
)
self.click(self.drv.find_element_by_class_name('page_nav__prev'))
self.input_field().send_keys(Keys.BACK_SPACE * 2, '15')
self.click(self.drv.find_element_by_class_name('navigate-right'))
self.assertEqual(
self.drv.find_element_by_tag_name('h3').text,
'b1'
)
self.click(self.drv.find_element_by_class_name('page_nav__prev'))
self.input_field().send_keys(Keys.BACK_SPACE * 2, '5')
self.click(self.drv.find_element_by_class_name('navigate-right'))
self.assertEqual(
self.drv.find_element_by_tag_name('h3').text,
'last question'
)
示例8: test_decimal_buckets
# 需要导入模块: from selenium.webdriver.common.keys import Keys [as 别名]
# 或者: from selenium.webdriver.common.keys.Keys import BACK_SPACE [as 别名]
def test_decimal_buckets(self):
survey_id = self.survey_with_branch(
'decimal',
'(1.2, 3.2)',
'[4.2, 5.2]'
)
self.get('/enumerate/{}'.format(survey_id))
self.wait_for_element('navigate-right', By.CLASS_NAME)
self.click(self.drv.find_element_by_class_name('navigate-right'))
(
self.drv
.find_element_by_tag_name('input')
.send_keys('1.3')
)
self.click(self.drv.find_element_by_class_name('navigate-right'))
self.assertEqual(
self.drv.find_element_by_tag_name('h3').text,
'b0'
)
self.click(self.drv.find_element_by_class_name('page_nav__prev'))
self.input_field().send_keys(Keys.BACK_SPACE * 3, '4.2')
self.click(self.drv.find_element_by_class_name('navigate-right'))
self.assertEqual(
self.drv.find_element_by_tag_name('h3').text,
'b1'
)
self.click(self.drv.find_element_by_class_name('page_nav__prev'))
self.input_field().send_keys(Keys.BACK_SPACE * 3, '1.2')
self.click(self.drv.find_element_by_class_name('navigate-right'))
self.assertEqual(
self.drv.find_element_by_tag_name('h3').text,
'last question'
)
示例9: test_date_buckets
# 需要导入模块: from selenium.webdriver.common.keys import Keys [as 别名]
# 或者: from selenium.webdriver.common.keys.Keys import BACK_SPACE [as 别名]
def test_date_buckets(self):
survey_id = self.survey_with_branch(
'date',
'(2015-01-01, 2015-01-03)',
'[2015-01-04, 2015-01-05]'
)
self.get('/enumerate/{}'.format(survey_id))
self.wait_for_element('navigate-right', By.CLASS_NAME)
self.click(self.drv.find_element_by_class_name('navigate-right'))
self.enter_date(
self.drv.find_element_by_tag_name('input'),
'2015', '01', '02'
)
self.click(self.drv.find_element_by_class_name('navigate-right'))
self.assertEqual(
self.drv.find_element_by_tag_name('h3').text,
'b0'
)
self.click(self.drv.find_element_by_class_name('page_nav__prev'))
self.input_field().send_keys(Keys.BACK_SPACE * 10)
self.enter_date(
self.drv.find_element_by_tag_name('input'),
'2015', '01', '04'
)
self.click(self.drv.find_element_by_class_name('navigate-right'))
self.assertEqual(
self.drv.find_element_by_tag_name('h3').text,
'b1'
)
self.click(self.drv.find_element_by_class_name('page_nav__prev'))
self.input_field().send_keys(Keys.BACK_SPACE * 10)
self.enter_date(
self.drv.find_element_by_tag_name('input'),
'2015', '01', '01'
)
self.click(self.drv.find_element_by_class_name('navigate-right'))
self.assertEqual(
self.drv.find_element_by_tag_name('h3').text,
'last question'
)
示例10: test_date_buckets_open_ranges
# 需要导入模块: from selenium.webdriver.common.keys import Keys [as 别名]
# 或者: from selenium.webdriver.common.keys.Keys import BACK_SPACE [as 别名]
def test_date_buckets_open_ranges(self):
survey_id = self.survey_with_branch(
'date',
'(, 2015-01-01)',
'[2015-01-10,]'
)
self.get('/enumerate/{}'.format(survey_id))
self.wait_for_element('navigate-right', By.CLASS_NAME)
self.click(self.drv.find_element_by_class_name('navigate-right'))
self.enter_date(
self.drv.find_element_by_tag_name('input'),
'2014', '11', '22'
)
self.click(self.drv.find_element_by_class_name('navigate-right'))
self.assertEqual(
self.drv.find_element_by_tag_name('h3').text,
'b0'
)
self.click(self.drv.find_element_by_class_name('page_nav__prev'))
self.input_field().send_keys(Keys.BACK_SPACE * 10)
self.enter_date(
self.drv.find_element_by_tag_name('input'),
'2015', '11', '22'
)
self.click(self.drv.find_element_by_class_name('navigate-right'))
self.assertEqual(
self.drv.find_element_by_tag_name('h3').text,
'b1'
)
self.click(self.drv.find_element_by_class_name('page_nav__prev'))
self.input_field().send_keys(Keys.BACK_SPACE * 10)
self.enter_date(
self.drv.find_element_by_tag_name('input'),
'2015', '01', '05'
)
self.click(self.drv.find_element_by_class_name('navigate-right'))
self.assertEqual(
self.drv.find_element_by_tag_name('h3').text,
'last question'
)
示例11: test_date_buckets_total_open
# 需要导入模块: from selenium.webdriver.common.keys import Keys [as 别名]
# 或者: from selenium.webdriver.common.keys.Keys import BACK_SPACE [as 别名]
def test_date_buckets_total_open(self):
survey_id = self.survey_with_branch('date', '(,)')
self.get('/enumerate/{}'.format(survey_id))
self.wait_for_element('navigate-right', By.CLASS_NAME)
self.click(self.drv.find_element_by_class_name('navigate-right'))
self.enter_date(
self.drv.find_element_by_tag_name('input'),
'1970', '01', '05'
)
self.click(self.drv.find_element_by_class_name('navigate-right'))
self.assertEqual(
self.drv.find_element_by_tag_name('h3').text,
'b0'
)
self.click(self.drv.find_element_by_class_name('page_nav__prev'))
self.input_field().send_keys(Keys.BACK_SPACE * 10)
self.enter_date(
self.drv.find_element_by_tag_name('input'),
'2070', '01', '05'
)
self.click(self.drv.find_element_by_class_name('navigate-right'))
self.assertEqual(
self.drv.find_element_by_tag_name('h3').text,
'b0'
)
示例12: test_timestamp_buckets
# 需要导入模块: from selenium.webdriver.common.keys import Keys [as 别名]
# 或者: from selenium.webdriver.common.keys.Keys import BACK_SPACE [as 别名]
def test_timestamp_buckets(self):
survey_id = self.survey_with_branch(
'timestamp',
'(2015-01-01T12:00:00Z, 2015-01-03T12:00:00Z)',
'[2015-01-04T12:00:00Z, 2015-01-05T12:00:00Z]'
)
self.get('/enumerate/{}'.format(survey_id))
self.wait_for_element('navigate-right', By.CLASS_NAME)
self.click(self.drv.find_element_by_class_name('navigate-right'))
self.enter_timestamp(
self.drv.find_element_by_tag_name('input'),
'2015-01-02T12:00:00'
)
self.click(self.drv.find_element_by_class_name('navigate-right'))
self.assertEqual(
self.drv.find_element_by_tag_name('h3').text,
'b0'
)
self.click(self.drv.find_element_by_class_name('page_nav__prev'))
self.input_field().send_keys(Keys.RIGHT * 30, Keys.BACK_SPACE * 30)
self.enter_timestamp(
self.drv.find_element_by_tag_name('input'),
'2015-01-04T12:00:00'
)
self.click(self.drv.find_element_by_class_name('navigate-right'))
self.assertEqual(
self.drv.find_element_by_tag_name('h3').text,
'b1'
)
self.click(self.drv.find_element_by_class_name('page_nav__prev'))
self.input_field().send_keys(Keys.RIGHT * 30, Keys.BACK_SPACE * 30)
self.enter_timestamp(
self.drv.find_element_by_tag_name('input'),
'2015-01-01T12:00:00'
)
self.click(self.drv.find_element_by_class_name('navigate-right'))
self.assertEqual(
self.drv.find_element_by_tag_name('h3').text,
'last question'
)
示例13: test_timestamp_buckets_total_open
# 需要导入模块: from selenium.webdriver.common.keys import Keys [as 别名]
# 或者: from selenium.webdriver.common.keys.Keys import BACK_SPACE [as 别名]
def test_timestamp_buckets_total_open(self):
survey_id = self.survey_with_branch('timestamp', '(,)')
self.get('/enumerate/{}'.format(survey_id))
self.wait_for_element('navigate-right', By.CLASS_NAME)
self.click(self.drv.find_element_by_class_name('navigate-right'))
self.enter_timestamp(
self.drv.find_element_by_tag_name('input'),
'1970-01-05T01:00:00'
)
self.click(self.drv.find_element_by_class_name('navigate-right'))
self.assertEqual(
self.drv.find_element_by_tag_name('h3').text,
'b0'
)
self.click(self.drv.find_element_by_class_name('page_nav__prev'))
self.input_field().send_keys(Keys.RIGHT * 30, Keys.BACK_SPACE * 30)
self.enter_timestamp(
self.drv.find_element_by_tag_name('input'),
'2070-01-05T01:00:00'
)
self.click(self.drv.find_element_by_class_name('navigate-right'))
self.assertEqual(
self.drv.find_element_by_tag_name('h3').text,
'b0'
)
示例14: change_date
# 需要导入模块: from selenium.webdriver.common.keys import Keys [as 别名]
# 或者: from selenium.webdriver.common.keys.Keys import BACK_SPACE [as 别名]
def change_date(_step, new_date):
button_css = 'div.post-preview a.edit-button'
world.css_click(button_css)
date_css = 'input.date'
date = world.css_find(date_css)
for i in range(len(date.value)):
date._element.send_keys(Keys.END, Keys.BACK_SPACE)
date._element.send_keys(new_date)
save_css = 'a.save-button'
world.css_click(save_css)
示例15: clear
# 需要导入模块: from selenium.webdriver.common.keys import Keys [as 别名]
# 或者: from selenium.webdriver.common.keys.Keys import BACK_SPACE [as 别名]
def clear(self, element):
# Selenium's clear command doesn't work
value = element.get_attribute("value")
for character in value:
element.send_keys(Keys.BACK_SPACE)