Drag and Drop method not performing any actions, simply that was executing not doing any actions

36 Views Asked by At

I'm just using I.dragAndDrop() method, it's not performing any actions. Simply it was passing without doing any actions

just small drag and drop function I'm trying to do, it was not throwing any errors.

And I'm included the drag and drop locator too, still not doing any actions

1

There are 1 best solutions below

0
Viper Lê On

try this:

let Actions = webdriver.ActionSequence;
let driver = new webdriver.Builder().forBrowser('chrome').build();

driver.get('your-website-url');

    let sourceElement = driver.findElement(webdriver.By.css('source-selector'));
    let targetElement = driver.findElement(webdriver.By.css('target-selector'));
    
    new Actions(driver)
        .dragAndDrop(sourceElement, targetElement)
        .perform();