本文整理汇总了Python中selenium.webdriver.common.action_chains.ActionChains.double_click方法的典型用法代码示例。如果您正苦于以下问题:Python ActionChains.double_click方法的具体用法?Python ActionChains.double_click怎么用?Python ActionChains.double_click使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类selenium.webdriver.common.action_chains.ActionChains
的用法示例。
在下文中一共展示了ActionChains.double_click方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_01_openingOT
# 需要导入模块: from selenium.webdriver.common.action_chains import ActionChains [as 别名]
# 或者: from selenium.webdriver.common.action_chains.ActionChains import double_click [as 别名]
def test_01_openingOT(self):
self.browser.find_element_by_id("sjEWebTree03").click()
sleep(2)
self.browser.find_element_by_id("sjEWebTree04").click()
sleep(2)
table = self.browser.find_element_by_id("gridview-1018-body")
firstOT = table.find_element_by_tag_name("tr") # pierwszy element
OT = firstOT.text.split("\n")
self.OT_PPE = OT[3] # pobierany PPE
actionChains = ActionChains(self.browser)
actionChains.double_click(firstOT.find_element_by_tag_name("td")).perform() # firstOT jest nie klikalne
sleep(4)
if "internet explorer" in self.browser.name:
print(self.browser.window_handles)
self.browser.switch_to_window(self.browser.window_handles[1])
self.browser.find_element_by_name("overridelink").click()
print(self.browser.window_handles)
self.browser.switch_to.window(self.browser.window_handles[1])
otkaPPE = self.browser.find_element_by_id("jEWebInputText2")
otkaHeader = otkaPPE.get_attribute("value")
# sprawdza czy NUMER PPE z tabeli zgadza się z numerem PPE w OTCE
self.assertAlmostEqual(self.OT_PPE, otkaHeader)
示例2: setup
# 需要导入模块: from selenium.webdriver.common.action_chains import ActionChains [as 别名]
# 或者: from selenium.webdriver.common.action_chains.ActionChains import double_click [as 别名]
def setup(self):
# Click on the PhyloTree app launcher and wait for it to load.
try:
button = self.window.find_element_by_link_text("PhyloTree")
except NoSuchElementException:
print >>sys.stderr, "fatal error: could not find the 'PhyloTree' button!"
print >>sys.stderr, "(visit %s to diagnose the problem)" % (url)
self.window.quit()
sys.exit(1)
button.click()
# Wait for the vtkweb process to start (but time out after 10 seconds).
if not vtkwebtest.wait_with_timeout(delay=0.5, limit=10, criterion=found_viewport(self.window)):
print >>sys.stderr, "fatal error: timed out while waiting for vtkweb process to start"
# Grab the body element to use as a positional reference.
body = self.window.find_element_by_tag_name("body")
# Double-click on a sub-tree to collapse it.
dblclick = ActionChains(self.window)
dblclick.move_to_element_with_offset(body, 475, 333)
dblclick.double_click()
dblclick.perform()
# Give the page some time to update the image.
time.sleep(1)
示例3: enter_text_in_element
# 需要导入模块: from selenium.webdriver.common.action_chains import ActionChains [as 别名]
# 或者: from selenium.webdriver.common.action_chains.ActionChains import double_click [as 别名]
def enter_text_in_element(driver, element, text, click=1, enter=True):
actions = ActionChains(driver)
actions.move_to_element(element)
if click == 1: actions.click()
elif click == 2: actions.double_click()
if enter:
text += Keys.ENTER
actions.send_keys(text)
actions.perform()
示例4: double_click_element
# 需要导入模块: from selenium.webdriver.common.action_chains import ActionChains [as 别名]
# 或者: from selenium.webdriver.common.action_chains.ActionChains import double_click [as 别名]
def double_click_element(self, locator):
"""Double click element identified by ``locator``.
See the `Locating elements` section for details about the locator
syntax.
"""
self.info("Double clicking element '%s'." % locator)
element = self.find_element(locator)
action = ActionChains(self.driver)
action.double_click(element).perform()
示例5: double_click_element
# 需要导入模块: from selenium.webdriver.common.action_chains import ActionChains [as 别名]
# 或者: from selenium.webdriver.common.action_chains.ActionChains import double_click [as 别名]
def double_click_element(self, locator):
"""Double click element identified by `locator`.
Key attributes for arbitrary elements are `id` and `name`. See
`introduction` for details about locating elements.
"""
self.info("Double clicking element '%s'." % locator)
element = self.find_element(locator)
action = ActionChains(self.browser)
action.double_click(element).perform()
示例6: get_to_class_list
# 需要导入模块: from selenium.webdriver.common.action_chains import ActionChains [as 别名]
# 或者: from selenium.webdriver.common.action_chains.ActionChains import double_click [as 别名]
def get_to_class_list(self):
self.browser.get("https://novasis.villanova.edu/pls/bannerprd/bvckschd.p_disp_dyn_sched")
time.sleep(2)
pressTerm = self.browser.find_element_by_xpath("//option[@value = '201630']")
actionChains = ActionChains(self.browser)
actionChains.double_click(pressTerm).perform()
time.sleep(2)
self.browser.find_element_by_xpath("//input[@type='submit']").send_keys(Keys.ENTER)
time.sleep(3)
self.browser.find_element_by_xpath("//input[@type='submit']").click()
示例7: double_click
# 需要导入模块: from selenium.webdriver.common.action_chains import ActionChains [as 别名]
# 或者: from selenium.webdriver.common.action_chains.ActionChains import double_click [as 别名]
def double_click(self, elem):
"""
Double click action on elem.
Parameters
----------
elem: `WebElement`
The WebElement to be double clicked on.
"""
a_chain = ActionChains(self.d)
a_chain.double_click(elem).perform()
return FileSystemPage(self.d)
示例8: testStep4
# 需要导入模块: from selenium.webdriver.common.action_chains import ActionChains [as 别名]
# 或者: from selenium.webdriver.common.action_chains.ActionChains import double_click [as 别名]
def testStep4(self):
# Navigate to the directory and verify text is displayed
variable = self.browser.find_element_by_id('nav-link-shopall')
actions = ActionChains(self.browser)
actions.move_to_element(variable)
actions.double_click(variable)
actions.perform()
directory = self.browser.find_element_by_id("siteDirectoryHeading").text
if "EARTH'S BIGGEST SELECTION" in directory:
assert(True)
else:
assert(False)
示例9: test_cycle_learning_intention_details_user_enrolled
# 需要导入模块: from selenium.webdriver.common.action_chains import ActionChains [as 别名]
# 或者: from selenium.webdriver.common.action_chains.ActionChains import double_click [as 别名]
def test_cycle_learning_intention_details_user_enrolled(self):
"""See that the 'traffic light' device cycles properly"""
# Gaby logs in to the site and heads to /lesson/1/lint/1
self.browser.get(self.server_url)
self._logUserIn('gaby', 'gaby5')
self.browser.get(self.server_url+'/courses/1/')
enrol = self.browser.find_element_by_id('id_enrol_button')
enrol.click()
self.browser.get(self.server_url+'/lesson/1/lint/1')
# There she finds a traffic light device showing red status
criterion = self.browser.find_element_by_xpath("//li[@class='criterion'][1]")
device = self.browser.find_element_by_xpath("//li[@class='criterion'][1]/img")
actions = ActionChains(self.browser)
actions.double_click(device)
self.assertEqual(criterion.text, u'Spot 3D modelling tasks')
self.assertEqual(device.get_attribute('id'), u'id_SC1')
self.assertEqual(
device.value_of_css_property('background-position'),
u'0px 0px')
self.assertTrue('tl-red' in device.get_attribute('class'))
# (DBL)Clicking once, it changes to amber.
actions.perform()
time.sleep(0.1)
self.assertEqual(
device.value_of_css_property('background-position'),
u'-17px 0px')
self.assertTrue('tl-amber' in device.get_attribute('class'))
# (DBL)Clicking again, the device changes to green.
actions.perform()
time.sleep(0.1)
self.assertEqual(
device.value_of_css_property('background-position'),
u'-34px 0px')
self.assertTrue('tl-green' in device.get_attribute('class'))
# A further (DBL)click, cycles the device round to red again
actions.perform()
time.sleep(0.1)
self.assertEqual(
device.value_of_css_property('background-position'),
u'0px 0px')
self.assertTrue('tl-red' in device.get_attribute('class'))
示例10: find_flight
# 需要导入模块: from selenium.webdriver.common.action_chains import ActionChains [as 别名]
# 或者: from selenium.webdriver.common.action_chains.ActionChains import double_click [as 别名]
def find_flight(from_city, to_city, depature_date, arrival_date):
# FROM
driver = webdriver.Firefox()
driver.get("http://www.skyscanner.pl")
try:
WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.ID, "js-origin-input")))
except TimeoutException:
print "Can't reach skyscanner page"
driver.close()
# raise TimeoutException(message)
# selenium.common.exceptions.TimeoutException: Message: "Can't reach skyscanner page":
#
#driver.quit()
origin = driver.find_element_by_id("js-origin-input")
actions = ActionChains(driver)
actions.double_click(origin)
actions.perform()
origin.send_keys(from_city)
time.sleep(1)
origin.send_keys(Keys.RETURN)
#TO
destination = driver.find_element_by_id("js-destination-input")
actions.double_click(destination)
actions.perform()
destination.send_keys(to_city)
time.sleep(1)
destination.send_keys(Keys.RETURN)
destination.send_keys(Keys.RETURN)
#SELECTING DATES
date_selector(driver, depature_date, return_date)
#MAKING SEARCH
searchButton = driver.find_element_by_id("js-search-button")
searchButton.click()
time.sleep(10) #Remove implicit wait and use explicit one as example below
#WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.CLASS_NAME, "day-progress-meter clearfix hidden")))
price_elements = driver.find_elements_by_class_name("filter-sub")
str_prices = []
clear_prices = []
prices = []
for obj in price_elements:
str_prices.append(obj.text)
clear_prices = [p for p in str_prices if p != 'brak'] # Filtering out 'none' price values
print clear_prices
for clear_price in clear_prices:
#Let's remove letters and convert price to integer. Example: "1 234 zl" -> 1234
prices.append(int(''.join(str(elem) for elem in [str(s) for s in clear_price.split() if s.isdigit()])))
sorted_prices = sorted(list(set(prices)))
return to_city, sorted_prices
示例11: test_01_openingOT
# 需要导入模块: from selenium.webdriver.common.action_chains import ActionChains [as 别名]
# 或者: from selenium.webdriver.common.action_chains.ActionChains import double_click [as 别名]
def test_01_openingOT(self):
self.browser.find_element_by_id("sjEWebTree03").click()
sleep(2)
self.browser.find_element_by_id("sjEWebTree04").click()
sleep(2)
otka = self.browser.find_element_by_class_name("x-grid-cell-inner ")
actionChains = ActionChains(self.browser)
actionChains.double_click(otka).perform()
sleep(4)
#TODO WINDOW HANDLER!!!!!
if "internet explorer" in self.browser.name:
print(self.browser.window_handles)
self.browser.switch_to(self.browser.window_handles[1])
self.browser.find_element_by_name("overridelink").click()
sleep(2)
示例12: editor_page
# 需要导入模块: from selenium.webdriver.common.action_chains import ActionChains [as 别名]
# 或者: from selenium.webdriver.common.action_chains.ActionChains import double_click [as 别名]
def editor_page(self):
""" Return :class:`ComponentPage` for this component. """
for retry in range(3):
try:
chain = ActionChains(self.browser)
chain.double_click(self.slot).perform()
except StaleElementReferenceException:
if retry < 2:
logging.warning("StaleElementReferenceException" " in SlotFigure.editor_page()")
else:
raise
else:
break
editor_id = "CE-%s" % self.pathname.replace(".", "-")
return ComponentPage(self.browser, self.port, (By.ID, editor_id))
示例13: doubleclick
# 需要导入模块: from selenium.webdriver.common.action_chains import ActionChains [as 别名]
# 或者: from selenium.webdriver.common.action_chains.ActionChains import double_click [as 别名]
def doubleclick(xpathvar, xpath, text, ptext, x):
global closev
global driver
link = xpath + xpathvar + closev
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, link)))
actionChains = ActionChains(driver)
objsel = driver.find_element_by_xpath(link)
actionChains.double_click(objsel).perform()
if ptext != "":
texttobepresent()
elif ptext == "":
pass
if x == 'y':
tstlog.printscreen(text)
else:
tstlog.noprintscreen(text)
示例14: gettingStatus
# 需要导入模块: from selenium.webdriver.common.action_chains import ActionChains [as 别名]
# 或者: from selenium.webdriver.common.action_chains.ActionChains import double_click [as 别名]
def gettingStatus(self):
"""
Ma otworzyć OT tylko ze statusem rejestracja
"""
OTtable = self.browser.find_element_by_id("gridview-1018-body")
tableElements = OTtable.find_elements_by_tag_name("tr")
for row in tableElements:
x = row.text.split("\n")
if "Rejestracja" in x:
OTid = self.browser.find_element_by_id(row.get_attribute("id"))
actionChains = ActionChains(self.browser)
actionChains.double_click(OTid).perform()
sleep(3)
self.browser.switch_to.window(self.browser.window_handles[1]) # musi przejsc na drugie okno
sleep(2)
break
示例15: editor_page
# 需要导入模块: from selenium.webdriver.common.action_chains import ActionChains [as 别名]
# 或者: from selenium.webdriver.common.action_chains.ActionChains import double_click [as 别名]
def editor_page(self, double_click=True):
""" Return :class:`ComponentPage` for this component. """
for retry in range(3):
try:
chain = ActionChains(self.browser)
if double_click:
chain.double_click(self.root).perform()
else:
self._context_click('edit_button')
chain.release(None).perform()
except StaleElementReferenceException:
if retry < 2:
logging.warning('StaleElementReferenceException'
' in SlotFigure.editor_page()')
else:
raise
else:
break
editor_id = 'ObjectFrame_%s' % self.pathname.replace('.', '-')
return ComponentPage(self.browser, self.port, (By.ID, editor_id))