How to drag and drop inside iframe .

821 views
Skip to first unread message

Abhishek Bisht

unread,
Jan 30, 2014, 6:12:03 AM1/30/14
to webd...@googlegroups.com
Hi all,

I am trying to drag an element from outside a frame and drop to inside but drag and drop is not working as target location is inside an iframe does any one know any solution or work around for it?

Thanks
Abhishek Bisht

Øystein

unread,
Jan 30, 2014, 6:43:55 AM1/30/14
to webd...@googlegroups.com

Hi!

 

That is a very good question.

 

I have never come across a problem like this but I would love to see the solution. I have a idea you might try tho. Let me know if it works or if you find a way to get it to workJ

 

var action = new Actions(Driver);

action.ClickAndHold(elementToDrag).Build().Perform();

Driver.SwitchTo().Frame(nameOfFrame);

action.MoveToElement(targetElement).Build().Perform();

action.Release(targetElement).Build().Perform();

 

//Austin

--
You received this message because you are subscribed to the Google Groups "webdriver" group.
To unsubscribe from this group and stop receiving emails from it, send an email to webdriver+...@googlegroups.com.
To post to this group, send email to
webd...@googlegroups.com.
Visit this group at http://groups.google.com/group/webdriver.
For more options, visit https://groups.google.com/groups/opt_out.

darrell

unread,
Jan 30, 2014, 8:05:11 AM1/30/14
to webd...@googlegroups.com
Last time I had to handle this situation (it has been a few years) I believe I figured out the size of the iframe, the position of the item in the iframe then calculated the x,y movement from outside the iframe. So if the distance from the current location to the edge of the iframe was 85,10 and the movement from inside the iframe was 100,0 then I would do a x,y move of 185,10 and drop the object inside the iframe from outside the iframe.

Abhishek Bisht

unread,
Jan 31, 2014, 1:27:17 AM1/31/14
to webd...@googlegroups.com
Thanks Austin and darrel for replying.

I tried both these ways through location and through action but evey time at the time of release i get the exception that element is in different frame.
Is there any work around or any other way to achieve this??

Thanks

Anthony Browness

unread,
Feb 11, 2014, 12:46:51 AM2/11/14
to webd...@googlegroups.com
I'd love to try this. Do you have an example online I can play with?

sunny sachdeva

unread,
Feb 13, 2014, 12:52:00 PM2/13/14
to webd...@googlegroups.com
this seems to be very interesting.

Abhishek,

Could you please share us the site where you facign this issue

Thanks
Sunny
Reply all
Reply to author
Forward
0 new messages