Why drag and drop is not working in Selenium Webdriver?

后端 未结 12 1658
借酒劲吻你
借酒劲吻你 2021-01-11 11:45

I am trying to drag an element into another element using Selenium WebDriver but it\'s not working. I tried all the solutions which I can find on internet but none of the so

12条回答
  •  有刺的猬
    2021-01-11 11:52

    This is working for me :

    Actions act = new Actions(driver);
    act.moveToElement(element, (elementWidth / 2), elementHeight / 2).clickAndHold().build().perform();
    act.moveToElement(dest, (destWidth / 2) , (destHeight / 2)).release().build().perform();
    

    There are sometimes bugs in some version of selenium. Make sure you use the lastest one and play around with clicking. Would be easier of you can send a link of what you are trying to drag/drop

提交回复
热议问题