以下のコードでSelenium 3.0のドラッグアンドドロップをテストし、コードが動作していないことを確認します。ドラッグ&ドロップがSelenium 3.0で機能していない
セレン2.53で同じコードを試してみましたが、動作しています。親切にも誰かが私のコードを見直して、私が何かを見逃していたら教えてください。
セレン3.0
ブラウザ:Mozillaの2.52
package dynamicXpath;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxProfile;
import org.openqa.selenium.interactions.Action;
import org.openqa.selenium.interactions.Actions;
public class refermeprobI {
public static void main(String[] args) throws InterruptedException{
System.setProperty("webdriver.gecko.driver", "D:\\Drivers\\geckodriver.exe");
FirefoxProfile profile = new FirefoxProfile();
profile.setEnableNativeEvents(true);
WebDriver driver = new FirefoxDriver(profile);
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);
driver.get("https://the-internet.herokuapp.com/drag_and_drop");
Actions act = new Actions(driver);
WebElement src = driver.findElement(By.xpath("//*[@id='column-a']"));
WebElement dst = driver.findElement(By.xpath("//*[@id='column-b']"));
act.dragAndDrop(src, dst).build().perform();
System.out.println(driver.findElement(By.xpath("//*[@id='column-b']/header")).getText());
}
}
あなたのコードにエラーはありません。しかし、私はあなたのMozilla Firefoxのバージョンとgeckodriverのバージョンについてまだよく分かりません。ドラッグ&ドロップはSelenium 3.xでうまくいきました。 – DebanjanB
geckodriverのどのバージョンをお使いですか? –
'setEnableNativeEvents(true)'が償却されているのがわかります。それでも使える? – DebanjanB