How to perform Drag and Drop using selenium webdriver
Here in this tutorial you will learn how to do drag and drop in selenium, perform drag and drop in selenium, drag and drop using selenium webdriver. Test drag and drop feature.
===== selenium script ======
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.interactions.Actions;
public class DragAndDrop
{
public static void main(String[] args)
{
WebDriver driver=new FirefoxDriver();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.get(" http://www.dhtmlgoodies.com/submitted...");
String xp1="//h1[text()='Block 1']";
WebElement source = driver.findElement(By.xpath(xp1));
String xp2="//h1[text()='Block 3']";
WebElement target = driver.findElement(By.xpath(xp2));
Actions actions=new Actions(driver);
actions.dragAndDrop(source, target).perform();
}
}
------------------------------------------------------------------------------------------------------------
Please subscribe us:
https://www.youtube.com/c/EasyTutoria...
Like us on Facebook:
https://www.facebook.com/EasyTutorial...
Here in this tutorial you will learn how to do drag and drop in selenium, perform drag and drop in selenium, drag and drop using selenium webdriver. Test drag and drop feature.
===== selenium script ======
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.interactions.Actions;
public class DragAndDrop
{
public static void main(String[] args)
{
WebDriver driver=new FirefoxDriver();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.get(" http://www.dhtmlgoodies.com/submitted...");
String xp1="//h1[text()='Block 1']";
WebElement source = driver.findElement(By.xpath(xp1));
String xp2="//h1[text()='Block 3']";
WebElement target = driver.findElement(By.xpath(xp2));
Actions actions=new Actions(driver);
actions.dragAndDrop(source, target).perform();
}
}
------------------------------------------------------------------------------------------------------------
Please subscribe us:
https://www.youtube.com/c/EasyTutoria...
Like us on Facebook:
https://www.facebook.com/EasyTutorial...
How to perform Drag and Drop in selenium webdriver | Selenium Tutorial | |
13 Likes | 13 Dislikes |
6,691 views views | 57,381 followers |
Education | Upload TimePublished on 27 Apr 2015 |
No comments:
Post a Comment