TestProject Forum
Powered by leading experts in the test automation community

Swap places of 2 items in sortable list

Hi,
I am kind of new to selenium, is there a way to automate a ‘swap’ between 2 elements in a sortable list ?

for example http://alloyui.com/examples/sortable-list/

Lets say i want to change places between item 5 & 6 ?

You can do it with the Actions class.

[code]Actions builder = new Actions(driver);

Action dragAndDrop = builder.clickAndHold(firstElement)
.moveToElement(secondElement)
.release(secondElement)
.build();

dragAndDrop.perform();[/code]