Drag and Drop not working in selenium code

后端 未结 4 1103
半阙折子戏
半阙折子戏 2021-01-29 13:56

Drag and Drop is not working in my selenium code below, can anyone help me?

package selenium;

import java.util.concurrent.TimeUnit;

import org.apache.log4j.Bas         


        
4条回答
  •  渐次进展
    2021-01-29 14:30

    Find your own working code block with some simple tweaks in it:

    //BasicConfigurator.configure();
    System.setProperty("webdriver.gecko.driver", "C:\\Utility\\BrowserDrivers\\geckodriver.exe");
    WebDriver driver=new FirefoxDriver();
    driver.get("http://jqueryui.com/droppable/");
    driver.manage().timeouts().implicitlyWait(5,TimeUnit.SECONDS);
    driver.switchTo().frame(driver.findElement(By.xpath("//iframe[@class='demo-frame']")));
    WebElement  from = driver.findElement(By.id("draggable"));
    WebElement  to = driver.findElement(By.id("droppable"));
    new Actions(driver).dragAndDrop(from, to).build().perform();
    

提交回复
热议问题