Below is the code :
import java.util.List;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
public class draglist
{
public static void main(String[] args) throws Exception
{
FirefoxDriver fd=new FirefoxDriver();
fd.get("http://demos.telerik.com/aspnet-ajax/listbox/examples/overview/defaultcs.aspx");
Thread.sleep(5000);
WebElement l1=fd.findElement(By.xpath("/html/body/form/div[7]/div[3]/div[2]/div/div[3]/div/div/div/div[2]/div/ul"));
Thread.sleep(2000);
List<WebElement> lst=l1.findElements(By.tagName("li"));
l1.sendKeys(Keys.CONTROL);
lst.get(0).click();
lst.get(2).click();
lst.get(4).click();
fd.findElement(By.xpath("/html/body/form/div[7]/div[3]/div[2]/div/div[3]/div/div/div/div[2]/table/tbody/tr/td/a/span/span/span/span/span")).click();
}
}
import java.util.List;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
public class draglist
{
public static void main(String[] args) throws Exception
{
FirefoxDriver fd=new FirefoxDriver();
fd.get("http://demos.telerik.com/aspnet-ajax/listbox/examples/overview/defaultcs.aspx");
Thread.sleep(5000);
WebElement l1=fd.findElement(By.xpath("/html/body/form/div[7]/div[3]/div[2]/div/div[3]/div/div/div/div[2]/div/ul"));
Thread.sleep(2000);
List<WebElement> lst=l1.findElements(By.tagName("li"));
l1.sendKeys(Keys.CONTROL);
lst.get(0).click();
lst.get(2).click();
lst.get(4).click();
fd.findElement(By.xpath("/html/body/form/div[7]/div[3]/div[2]/div/div[3]/div/div/div/div[2]/table/tbody/tr/td/a/span/span/span/span/span")).click();
}
}