Selenium驱动程序Python拖放,元素被放置在哪里是指针而不是放置区域 [英] Selenium driver Python drag and drop, element is dropped where is pointer and not dropping area
本文介绍了Selenium驱动程序Python拖放,元素被放置在哪里是指针而不是放置区域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
拖动动作有效,但不是将鼠标放在选定区域,而是放在鼠标指针位置.有人有主意吗?谢谢
The drag action is working, but instead of drop in the selected area, drop on mouse pointer position. Someone has any idea? Thanks
def test_drag_action_to_tsb(self, driver):
source_element = driver.find_element_by_xpath('//*[@id="bzm-action-builder-tabs-tabpane-ACTION"]/ul/li[1]')
base.wait_for_element(driver, By.CLASS_NAME, 'scriptless-scenarios-steps-panel')
dest_element = driver.find_element_by_class_name(self, 'scriptless-scenarios-steps-panel')
ActionChains(driver).click_and_hold(source_element).move_to_element(dest_element).release(dest_element).perform()
time.sleep(5)
assert base.is_text_present(driver, 'is Required')
time.sleep(5)
推荐答案
Depending on selenium documentation following codes should work :
ActionChains(driver). drag_and_drop(source_element, dest_element).perform()
这篇关于Selenium驱动程序Python拖放,元素被放置在哪里是指针而不是放置区域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文