Drag element to iframe

187 views
Skip to first unread message

Dragisa Krtolica

unread,
Jun 5, 2012, 4:10:15 PM6/5/12
to webd...@googlegroups.com
Hello there,
I have an element is outside iframe  and I need to drag it to the iframe.   Problem is it is not working (or more likely I  am missing something) . 
Simplified html is:

<html lang="en">
<head>

</head>
<body id="LeftMenuBG" onload="forms_onload();">

blah blah


<iframe src="javascript:''" id="application" style="position: absolute; width: 0pt; height: 0pt; border: medium none;"
        tabindex="-1"></iframe>
<div class="window" style="position: absolute; z-index: 100; top: 0px; left: 67px;">
    <div class="window-title">
        <div class="gwt-Label">Email Message</div>
        <div class="window-close"></div>
    </div>
    <div class="window-content" style="width: 700px;">
        <table width="100%" cellspacing="0" cellpadding="0">
            <tbody>


            <tr>
                <td align="left" style="vertical-align: top;">
                    <iframe class="rich-text-area" style="width: 698px; height: 360px;"></iframe>
                </td>
            </tr>

            </tbody>
        </table>
    </div>
    <div class="window-sidebar" style="height: 480px;">
        <div>
            <div class="palette-panel">
                <div class="title">Form Properties</div>
                <div class="container">
                    <div class="filter-list">
                        <div class="header"><input type="text" class="text filter hint"></div>
                        <ol>
                            <li draggable="true"><img src="/static/images/icons/textfield18.gif" class="icon"
                                                      style="width: 18px; height: 18px;" title="Text">

                                <div class="gwt-Label" id="text">text</div>
                            </li>
                        </ol>
                    </div>
                </div>
            </div>

    </div>

</div>

</body>
</html>


I am trying to drag <div class="gwt-Label" id="text">text</div>   to  <iframe class="rich-text-area" style="width: 698px; height: 360px;"></iframe>.   Inside iframe is just body tag.


code that  I am using: 


WebElement source= driver.findElement(By.id("text"));
WebElement target = driver.switchTo ().frame(1).findElement(By.tagName("body"));
Actions actions = new Actions(driver);
actions.dragAndDrop(source,  target);

 
Any ideas?  I will even offer you a beer if you can  solve this and  you are in Vancouver, BC.  

Luke Inman-Semerau

unread,
Jun 5, 2012, 5:34:56 PM6/5/12
to webd...@googlegroups.com
html5 draggable events aren't working / implemented in selenium (from my experience and the few things I've tried).

You may have to synthesize your own javascript events and send that the JS executor


--
You received this message because you are subscribed to the Google Groups "webdriver" group.
To view this discussion on the web visit https://groups.google.com/d/msg/webdriver/-/b-f3LVwNpqsJ.
To post to this group, send email to webd...@googlegroups.com.
To unsubscribe from this group, send email to webdriver+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/webdriver?hl=en.

Dragisa Krtolica

unread,
Jun 5, 2012, 5:46:14 PM6/5/12
to webd...@googlegroups.com
thanks.  I will try to find solution that works for me, don't want to go down JS route (this is is a very small test case, not worth the effort)
To unsubscribe from this group, send email to webdriver+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages