Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在python selenium中双击div?_Python_Selenium_Webdriver_Bdd_Chrome Web Driver - Fatal编程技术网

如何在python selenium中双击div?

如何在python selenium中双击div?,python,selenium,webdriver,bdd,chrome-web-driver,Python,Selenium,Webdriver,Bdd,Chrome Web Driver,在behave步骤实现中,我希望使用webdriver双击一个div。然而,我无法实现这一点。我的代码: @when('i double click on the element "{text}"') def step_impl(context, text): action = webdriver.ActionChains(context.browser) action.double_click(context.browser.find_element_by_css_select

在behave步骤实现中,我希望使用webdriver双击一个div。然而,我无法实现这一点。我的代码:

@when('i double click on the element "{text}"')
def step_impl(context, text):
    action = webdriver.ActionChains(context.browser)
    action.double_click(context.browser.find_element_by_css_selector(text)).perform()
我也试过了

@when('i double click on the element "{text}"')
def step_impl(context, text):
    action = webdriver.ActionChains(context.browser)
    el = context.browser.find_element_by_css_selector(text)
    action.move_to_element_with_offset(el, 10, 10).double_click()
    action.perform()

find\u element\u by_css\u选择器
按预期返回一个
WebElement
。但是,
双击
javascript操作从未执行过-应该出现一个新的div-在场景步骤中无声地失败。

它在双击调用的末尾?哎呀,没有看到…可能是重复的