Swap places of 2 items in sortable list

  • 1 Replies
  • 1053 Views
Swap places of 2 items in sortable list
« on: April 10, 2016, 18:47:24 pm »
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 ?

Re: Swap places of 2 items in sortable list
« Reply #1 on: April 10, 2016, 19:55:44 pm »
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();

 

Sitemap 1 2 3 4 5 6 7 8