拖放不工作在我的硒代碼下面,任何人都可以幫助我嗎?拖放不工作在硒代碼
package selenium;
import java.util.concurrent.TimeUnit;
import org.apache.log4j.BasicConfigurator;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.WebElement;
public class draganddrop {
public static void main(String[] args){
BasicConfigurator.configure();
FirefoxDriver driver=new FirefoxDriver();
driver.get("http://jqueryui.com/droppable/");
driver.manage().timeouts().implicitlyWait(3,TimeUnit.SECONDS);
WebElement from= driver.findElementByXPath("html/body/div[1]");
WebElement to=driver.findElementByXPath("html/body/div[2]");
new Actions(driver).dragAndDrop(from, to).build().perform();
//Actions mouseoveron=new Actions(driver);
//mouseoveron.click().dragAndDrop(from, to).build().perform();
}
}
如果任何回答對你有幫助那麼請不要忘記去接受它。請閱讀https://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work – NarendraR