Usual drag & drop doesn't work on pages built with HTML5. Here, I've used Robot for controlling the Mouse Actions to work with HTML5 websites.
Snippet
public void dragAndDrop() throws AWTException, InterruptedException {
driver.get("http://demo.kaazing.com/forex/");
Actions builder = new Actions(driver);
WebElement sourceElement = driver.findElement(By.xpath("(//li[@name='dragSource'])[13]"));
Action drag = builder.clickAndHold(sourceElement).build();
drag.perform();
WebElement targetElement = driver.findElement(By.xpath("//section[@id='section1']/div[2]"));
Point coordinates = targetElement.getLocation();
Robot robot = new Robot(); //Robot for controlling mouse actions
robot.mouseMove(coordinates.getX(),coordinates.getY()+120);
Thread.sleep(5000);
}
Note| Java Robot can also be used for various actions like locating tooltips, etc.,
FYI, you can do HTML5-based drag & drop without having to use Robot or anything like Sikuli, AutoIt.
ReplyDeleteThere's a javascript/jQuery-based solution given in the bug tracker for HTML5 drag & drop support in Selenium:
https://code.google.com/p/selenium/issues/detail?id=3604
that is a lot more scalable than using Robot if you were to run tests over Grid and SauceLabs.
It was very nice blog to learn about SAP BASIS. Thanks for sharing.SAP basis
ReplyDeletehttp://letusnotifyyou.com/appium-selenium-configuration-latest-ios-version-10-3-2/
ReplyDeleteNice Blog Thank you for sharing..
ReplyDeleteReally nice and interesting.DataScience with Python Training in Bangalore
yeezy
ReplyDeletesupreme new york
lebron shoes
supreme
chrome hearts online store
yeezy 700
adidas yeezy
golden goose
golden goose sneakers
jordan 13