Drag and drop gets executed but its not getting performed - webdriver

后端 未结 1 1118
萌比男神i
萌比男神i 2021-01-15 00:45

I have tried these two codes , it get executed but the action does not get performed ,Can any one tell me why?

//Type one approach
Actions action = new Actio         


        
1条回答
  •  别那么骄傲
    2021-01-15 01:27

    Try this code:

     Actions ac = new Actions(driver);
     ac.dragAndDrop(source element, target element);
     ac.build().perform();
    

    It will click-and-hold at the location of the source element, moves to the location of the target element, then releases the mouse.

    Or

     Actions ac = new Actions(driver);
     ac.dragAndDropBy(source element, xOffset, yOffset);
     ac.build().perform();
    

    It will click-and-hold at the location of the source element, moves by a given offset, then releases the mouse.

    Or

        Actions ac = new Actions(driver);
        ac.clickAndHold(onElement);
        ac.moveToElement(toElement); or ac.moveToElement(toElement, xOffset, yOffset);
        ac.build().perform();
    

    It will do the action of the above two code.

    I write this code on Java. You can convert in to your specified language.

    Refereed from Actions.

    0 讨论(0)
提交回复
热议问题