Thursday, 15 May 2014

c# - Drag and drop gets executed but its not getting performed - webdriver -



c# - Drag and drop gets executed but its not getting performed - webdriver -

i have tried these 2 codes , executed action not performed ,can 1 tell me why?

//type 1 approach actions action = new actions(browser.driver); iwebelement sourceelement = browser.driver.findelement(by.xpath(filexpath)); iwebelement targetelement = browser.driver.findelement(by.xpath(newxpath)); //type 2 approach actions sourcebuilder = new actions(browser.driver); actions sourceaction = sourcebuilder.clickandhold(sourceelement); sourcebuilder.build(); sourceaction.perform(); /// move , drop actions builder = new actions(browser.driver); actions action = builder.movetoelement(targetelement); builder.release(targetelement); builder.build(); action.perform();

thanks in advance

try code:

actions ac = new actions(driver); ac.draganddrop(source element, target element); ac.build().perform();

it click-and-hold @ location of source element, moves location of target element, releases mouse.

or

actions ac = new actions(driver); ac.draganddropby(source element, xoffset, yoffset); ac.build().perform();

it click-and-hold @ location of source element, moves given offset, releases mouse.

or

actions ac = new actions(driver); ac.clickandhold(onelement); ac.movetoelement(toelement); or ac.movetoelement(toelement, xoffset, yoffset); ac.build().perform();

it action of above 2 code.

i write code on java. can convert in specified language.

refereed actions.

c# selenium webdriver selenium-webdriver

No comments:

Post a Comment