Why drag and drop is not working in Selenium Webdriver?

后端 未结 12 1660
借酒劲吻你
借酒劲吻你 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 12:15

    I would suggest you to use Touch Action to perform drag and drop.

    Point coordinates1 = sourceelement.getLocation();
    Point coordinates2 = destelement.getLocation();  
    TouchActions builder = new TouchActions(driver);
    builder.longPress(coordinates1)
           .move(coordinates2).release(coordinates2).perform();
    

提交回复
热议问题