dragAndDrop works in Firefox but not in Chrome

Wondering if people here are having a similar issue, I wrote a fairly basic script to pick up an element in one div and move it to another div. I can use either dragAndDropToObject or the drag and drop to offset function. Both work in Fire Fox. Neither work in Chrome. The interesting thing is the script does not fail in Chrome. It shows successful but the elements are not moved. Has anyone else encountered this? If so is there a browser element I can modify in desired capabilities? Thanks!

Hi @mfoos,

Can you share more details about your context of using dragAndDrop keyword? Any sample website that we can reproduce this issue?

I cannot, I really wish I could but it’s an internal product. That’s why I asked more of a general question. I can tell you I am using the function as intended with nothing out of the box included at all. For example here is what my call looks like,

WebUI.dragAndDropToObject(findTestObject(‘fromobject’), findTestObject(‘toobject’))

What I can tell you is I think maybe the javascript framework being used in is creating problems? It’s called Dojo. I know it’s pretty old. Maybe that’s it? It works in Firefox perfectly which is kind of strange. Anywho sorry I couldn’t provide anymore details. I was more or less wondering/hoping if someone had already seen something similar.


1 Like

I finally resolved this. It has something to do with the Chrome driver not “picking” up the element properly. I now use this function instead and it works in Firefox and Chrome.

public static void dragNDrop(TestObject element, TestObject container) {

	//Get a copy of the web driver element that you can use in Selenium
	WebDriver driver = DriverFactory.getWebDriver()

	//get elements
	WebElement eElement =  driver.findElement(By.xpath("${element.findPropertyValue('xpath')}"));
	WebElement eContainer = driver.findElement(By.xpath("${container.findPropertyValue('xpath')}"));

	Actions actions = new Actions(driver);

	//Move the element
			.moveByOffset(1, 1)
			.moveByOffset(1, 0)