java - Drag and Drop functionality is not working in selenium Webdriver -


i trying learn selenium. have following site drag , drop functionality available http://html5demos.com/drag#. trying drag , drop using below codes. not able same. on appreciated.

code 1

system.setproperty("webdriver.ie.driver", system.getproperty("user.dir")+"\\drivers\\iedriverserver.exe"); webdriver driver=new chromedriver(); driver.get("http://html5demos.com/drag"); driver.manage().window().maximize(); list<webelement> ele1=driver.findelements(by.id("bin")); system.out.println(ele1.size()); system.out.println(ele1.get(0).isdisplayed()); webelement ele2=driver.findelement(by.id("one")); system.out.println(ele1.get(0).isdisplayed()); system.out.println(ele2.isdisplayed()); actions builder = new actions(driver); action draganddrop = builder.clickandhold(ele2) .movetoelement(ele1.get(0)) .release(ele2) .build(); draganddrop.perform();  

code 2

(new actions(driver)).draganddrop(ele2, ele1.get(0)).perform(); 

code 3

actions builder = new actions(driver); builder.draganddropby(ele2, -50, 35).perform(); 

try this:

system.setproperty("webdriver.ie.driver", system.getproperty("user.dir")+"\\drivers\\iedriverserver.exe");  webdriver driver=new chromedriver();  driver.get("http://html5demos.com/drag");  driver.manage().window().maximize();  list<webelement> ele1=driver.findelements(by.id("bin")); system.out.println(ele1.size());  system.out.println(ele1.get(0).isdisplayed());  webelement ele2=driver.findelement(by.id("one")); system.out.println(ele1.get(0).isdisplayed());  system.out.println(ele2.isdisplayed());  actions builder = new actions(driver);  action draganddrop = builder.clickandhold(ele2).movetoelement(ele1.get(0)).release().build();       draganddrop.perform(); 

Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -