本文整理汇总了Python中selenium.webdriver.common.action_chains.ActionChains.key_up方法的典型用法代码示例。如果您正苦于以下问题:Python ActionChains.key_up方法的具体用法?Python ActionChains.key_up怎么用?Python ActionChains.key_up使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类selenium.webdriver.common.action_chains.ActionChains
的用法示例。
在下文中一共展示了ActionChains.key_up方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_groupRename
# 需要导入模块: from selenium.webdriver.common.action_chains import ActionChains [as 别名]
# 或者: from selenium.webdriver.common.action_chains.ActionChains import key_up [as 别名]
def test_groupRename(self):
driver = self.driver
timeout = selectBrowser._getSleep()
#Load images
Util.load_image( self, driver, "Orion.methanol.cbc.contsub.image.fits")
Util.load_image( self, driver, "Orion.cont.image.fits")
Util.load_image( self, driver, "TWHydra_CO2_1line.image.fits")
time.sleep( 2 )
#Open the image settings
#Open the stack tab
Util.openSettings( self, driver, "Image", True )
Util.clickTab( driver, "Stack" )
#Turn off auto select
autoSelectCheck = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.ID, "autoSelectImages")))
ActionChains(driver).click( autoSelectCheck ).perform()
#Group the bottom two images.
secondItem = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, "//div[@qxclass='skel.widgets.Image.Stack.TreeItem']/div[text()='Orion.cont.image.fits']/..")))
actions = ActionChains( driver).key_down(Keys.SHIFT).click( secondItem )
actions.key_up( Keys.SHIFT ).perform()
#Click the group check box.
groupCheck = WebDriverWait( driver, 10).until( EC.presence_of_element_located((By.ID, "stackGroupImages")))
ActionChains(driver).click( groupCheck ).perform()
time.sleep(2)
#Change the name of the group to twoImageRGB & verify that there is a tree node with that name..
nameText = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, "//input[starts-with(@id, 'stackLayerName')]")))
Util._changeElementText(self, driver, nameText, "twoImageRGB")
WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, "//div[contains(text(),'twoImageRGB')]")))
示例2: shop_button_second_slide_click
# 需要导入模块: from selenium.webdriver.common.action_chains import ActionChains [as 别名]
# 或者: from selenium.webdriver.common.action_chains.ActionChains import key_up [as 别名]
def shop_button_second_slide_click(self):
self._driver.find_element(*HomePage.second_products_slide).click()
action = ActionChains(self._driver)
action.key_down(Keys.SHIFT)
time.sleep(2)
action.click(self._driver.find_element(*HomePage.shop_button_second_slide))
action.key_up(Keys.SHIFT)
action.perform()
示例3: open_link_in_new_tab
# 需要导入模块: from selenium.webdriver.common.action_chains import ActionChains [as 别名]
# 或者: from selenium.webdriver.common.action_chains.ActionChains import key_up [as 别名]
def open_link_in_new_tab(self, elem):
CONTROL_KEY = get_control_key()
actions = ActionChains(self.driver)
actions.move_to_element(elem)
actions.key_down(CONTROL_KEY)
actions.click(elem)
actions.key_up(CONTROL_KEY)
actions.perform()
示例4: paste_values
# 需要导入模块: from selenium.webdriver.common.action_chains import ActionChains [as 别名]
# 或者: from selenium.webdriver.common.action_chains.ActionChains import key_up [as 别名]
def paste_values(driver, el=None):
actions = ActionChains(driver)
if el:
actions.move_to_element(el)
actions.key_down(Keys.SHIFT)
actions.send_keys(Keys.INSERT)
actions.key_up(Keys.SHIFT)
#actions.send_keys(Keys.CONTROL, 'v')
actions.perform()
示例5: twitter_social_info
# 需要导入模块: from selenium.webdriver.common.action_chains import ActionChains [as 别名]
# 或者: from selenium.webdriver.common.action_chains.ActionChains import key_up [as 别名]
def twitter_social_info(self):
# Create an Instance from ActionChains
action = ActionChains(self._driver)
# Find the Twitter link in the home page then click on it
self._driver.find_element(*HomePage.twitter_link)
# The below steps are used to open the facebook_link in a new window instead of a new tab
action.key_down(Keys.SHIFT)
action.click(self._driver.find_element(*HomePage.twitter_link))
action.key_up(Keys.SHIFT)
action.perform()
示例6: drag_element_at_position
# 需要导入模块: from selenium.webdriver.common.action_chains import ActionChains [as 别名]
# 或者: from selenium.webdriver.common.action_chains.ActionChains import key_up [as 别名]
def drag_element_at_position(self, element, x, y, dx, dy, mod=None):
actions = ActionChains(self._driver)
if mod:
actions.key_down(mod)
actions.move_to_element_with_offset(element, x, y)
actions.click_and_hold()
actions.move_by_offset(dx, dy)
actions.release()
if mod:
actions.key_up(mod)
actions.perform()
示例7: key_up
# 需要导入模块: from selenium.webdriver.common.action_chains import ActionChains [as 别名]
# 或者: from selenium.webdriver.common.action_chains.ActionChains import key_up [as 别名]
def key_up(self, locator, keySequence):
"""
Releases a modifier key.
:Args:
- key: The modifier key to send. Values are defined in Keys class.
- target: The element to send keys.
If None, sends a key to current focused element.
"""
el = self.driver.find_element(self.getBy(locator), self.getValue(locator))
actionChains = ActionChains(self.driver)
actionChains.key_up(keySequence, el).perform()
示例8: move_to_ele
# 需要导入模块: from selenium.webdriver.common.action_chains import ActionChains [as 别名]
# 或者: from selenium.webdriver.common.action_chains.ActionChains import key_up [as 别名]
def move_to_ele(driver,ele,act='down'):
action=ActionChains(driver)
# 先向下翻页,再移动到元素
if act=='down':
if False: #废弃不用。虽然向下翻页更直观,但是重复10次调用,速度太慢
i=0
while i<10:
i+=1
action.key_up(keys.Keys.DOWN)
action.move_to_element(ele).perform()
action.key_up(keys.Keys.PAGE_DOWN).move_to_element(ele).perform()
else:
action.move_to_element(ele).perform()
示例9: _click_with_modifier
# 需要导入模块: from selenium.webdriver.common.action_chains import ActionChains [as 别名]
# 或者: from selenium.webdriver.common.action_chains.ActionChains import key_up [as 别名]
def _click_with_modifier(self, locator, tag, modifier):
self.info("Clicking %s '%s' with %s." % (tag if tag[0] else 'element', locator, modifier))
modifier = self.parse_modifier(modifier)
action = ActionChains(self.driver)
for item in modifier:
action.key_down(item)
element = self.find_element(locator, tag=tag[0], required=False)
if not element:
element = self.find_element(locator, tag=tag[1])
action.click(element)
for item in modifier:
action.key_up(item)
action.perform()
示例10: test_groupUngroup
# 需要导入模块: from selenium.webdriver.common.action_chains import ActionChains [as 别名]
# 或者: from selenium.webdriver.common.action_chains.ActionChains import key_up [as 别名]
def test_groupUngroup(self):
driver = self.driver
timeout = selectBrowser._getSleep()
# Load images
Util.load_image(self, driver, "Orion.methanol.cbc.contsub.image.fits")
Util.load_image(self, driver, "Orion.cont.image.fits")
Util.load_image(self, driver, "TWHydra_CO2_1line.image.fits")
time.sleep(2)
# Open the image settings
# Open the stack tab
Util.openSettings(self, driver, "Image", True)
Util.clickTab(driver, "Stack")
# Turn off auto select
autoSelectCheck = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.ID, "autoSelectImages")))
ActionChains(driver).click(autoSelectCheck).perform()
# Select all images (The third should already be selected so selecting
# the first with a shift should do it).
firstItem = WebDriverWait(driver, 10).until(
EC.presence_of_element_located(
(
By.XPATH,
"//div[@qxclass='skel.widgets.Image.Stack.TreeItem']/div[text()='Orion.methanol.cbc.contsub.image.fits']/..",
)
)
)
actions = ActionChains(driver).key_down(Keys.SHIFT).click(firstItem)
actions.key_up(Keys.SHIFT).perform()
# Click the group check box.
groupCheck = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.ID, "stackGroupImages")))
ActionChains(driver).click(groupCheck).perform()
time.sleep(2)
# Verify that the images now have RGB boxes.
self._verifyRGB(driver, "Orion.methanol.cbc.contsub.image.fits", "rgba(255, 0, 0, 1)")
self._verifyRGB(driver, "Orion.cont.image.fits", "rgba(0, 255, 0, 1)")
self._verifyRGB(driver, "TWHydra_CO2_1line.image.fits", "rgba(0, 0, 255, 1)")
# Ungroup the images.
groupCheck = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.ID, "stackGroupImages")))
ActionChains(driver).click(groupCheck).perform()
time.sleep(2)
# Verify the images have transparent RGB boxes.
self._verifyRGB(driver, "Orion.methanol.cbc.contsub.image.fits", "rgba(0, 0, 0, 0)")
self._verifyRGB(driver, "Orion.cont.image.fits", "rgba(0, 0, 0, 0)")
self._verifyRGB(driver, "TWHydra_CO2_1line.image.fits", "rgba(0, 0, 0, 0)")
示例11: perform_box_selection
# 需要导入模块: from selenium.webdriver.common.action_chains import ActionChains [as 别名]
# 或者: from selenium.webdriver.common.action_chains.ActionChains import key_up [as 别名]
def perform_box_selection(selenium, start, end, hold_shift=False):
canvas = selenium.find_element_by_tag_name('canvas')
wait_for_canvas_resize(canvas, selenium)
actions = ActionChains(selenium)
if hold_shift:
actions.key_down(Keys.LEFT_SHIFT)
actions.move_to_element_with_offset(canvas, *start)
actions.click_and_hold()
actions.move_by_offset(*end)
actions.release()
if hold_shift:
actions.key_up(Keys.LEFT_SHIFT)
actions.perform()
示例12: _select_items_from_file_list_upon_cond
# 需要导入模块: from selenium.webdriver.common.action_chains import ActionChains [as 别名]
# 或者: from selenium.webdriver.common.action_chains.ActionChains import key_up [as 别名]
def _select_items_from_file_list_upon_cond(driver, item_list, keys,
cond=_is_file_selected,
all_items=None):
all_items = all_items if all_items else _get_items_from_file_list(driver)
actions = ActionChains(driver)
for key in keys:
actions.key_down(key)
for item_name in parse_seq(item_list):
item = all_items.get(item_name)
if cond(item):
actions.click(item[0])
for key in keys:
actions.key_up(key)
actions.perform()
示例13: roll_down
# 需要导入模块: from selenium.webdriver.common.action_chains import ActionChains [as 别名]
# 或者: from selenium.webdriver.common.action_chains.ActionChains import key_up [as 别名]
def roll_down(driver, dts):
"""滚动到页面底端"""
if not IsWindows: # 滚动到最底端in linux
action = ActionChains(driver)
action.key_up(keys.Keys.END) # 还有send_keys 或 key_down
i = 0
while i < 3: # 至少3次才可以保证100个商品完全出现
i = i + 1
action.perform()
else: # in windows 待测试????
i = 0
while i < 3:
i += 1
action = ActionChains(driver)
action.move_to_element(dts[-1]).perform()
dts = driver.find_elements_by_class_name("pro_list_pic")
示例14: product_image_click
# 需要导入模块: from selenium.webdriver.common.action_chains import ActionChains [as 别名]
# 或者: from selenium.webdriver.common.action_chains.ActionChains import key_up [as 别名]
def product_image_click(self):
if self._driver.find_element(*NegativeCases.pick_me_button).is_displayed():
self._driver.find_element(*NegativeCases.product_image).click()
if not (self._driver.find_element(*NegativeCases.pick_me_button).is_displayed()):
action = ActionChains(self._driver)
action.key_down(Keys.ESCAPE)
action.key_up(Keys.ESCAPE)
action.perform()
if self._driver.find_element(*NegativeCases.pick_me_button).is_displayed():
return True
else:
return False
else:
return False
else:
return False
示例15: copy_table_rows
# 需要导入模块: from selenium.webdriver.common.action_chains import ActionChains [as 别名]
# 或者: from selenium.webdriver.common.action_chains.ActionChains import key_up [as 别名]
def copy_table_rows(driver, rows):
actions = ActionChains(driver)
row = get_table_row(driver, rows[0])
actions.move_to_element(row)
actions.click()
actions.key_down(Keys.SHIFT)
for r in rows[1:]:
row = get_table_row(driver, r)
actions.move_to_element(row)
actions.click()
actions.key_up(Keys.SHIFT)
actions.key_down(Keys.CONTROL)
actions.send_keys(Keys.INSERT)
actions.key_up(Keys.CONTROL)
#actions.send_keys(Keys.CONTROL, 'c')
actions.perform()