2017-01-13 12 views
0

コードは正常に実行されますが、ドラッグ&ドロップはクロムで実行されません。以下のコードを試してみてくださいSelenium Webdriverクロムのバージョン46ではドラッグ&ドロップが動作しませんが、Firefoxでは動作します

WebElement From = driver.findElement(By.xpath("/html/body/reporting-layout/div/ui-view/add-statistics/div/statistics-query-builder/div/div[1]/selected-entities/div/div[2]/a[1]/span")); 
WebDriverWait wait = new WebDriverWait(driver, 50); 
WebElement element = wait.until(ExpectedConditions.presenceOfElementLocated(By.id("droppable-column-container"))); 
WebElement To = driver.findElement(By.id("droppable-column-container")); 
Actions builder = new Actions(driver); 
Action dragAndDrop = builder.clickAndHold(From) 
.moveToElement(To) 
.release(To) 
.build(); 
driver.manage().timeouts().implicitlyWait(50,TimeUnit.SECONDS); 
dragAndDrop.perform(); 

誰かが私の助けてくれますか?

答えて

0

コードを試してみてください。

WebElement from = driver.findElement(By.xpath("/html/body/reporting-layout/div/ui-view/add-statistics/div/statistics-query-builder/div/div[1]/selected-entities/div/div[2]/a[1]/span"));    
WebElement to = driver.findElement(By.id("droppable-column-container")); 

Actions act = new Actions(driver); 
act.clickAndHold(from).build().perform(); 
Thread.sleep(4000); 
act.clickAndHold(to).moveToElement(to).release(to).build().perform(); 
Thread.sleep(2000); 
+0

私の答えはあなたのお手伝いですか?そうであれば、この回答に「受け入れられる」とマークしてください。 –

関連する問題