using drag_and_drop_on with watir-webdriver

165 views
Skip to first unread message

marc betts

unread,
Apr 26, 2011, 8:42:53 AM4/26/11
to watir-...@googlegroups.com
One of the big things I like about watir-webdriver is the ability to drag and drop page elements. This works in version 0.2.0 and seems to have stopped working with version 0.2.1. I'm trying to figure out if this was by design, and if so, is there a better way to accomplish what I'm trying to do.

browser.div(:id=>"some_div").element.drag_and_drop_on(browser.div(:id=>"some_other_div").element)

NoMethodError: undefined method `drag_and_drop_on' for #<Watir::HTMLElement:0x33
05838 located=false selector={}>
    C:/Ruby187/lib/ruby/gems/1.8/gems/watir-webdriver-0.2.1/lib/watir-webdriver/
elements/element.rb:283:in `method_missing'

Thanks,
Marc

Jari Bakken

unread,
Apr 26, 2011, 9:04:18 AM4/26/11
to watir-...@googlegroups.com
Hi,

On Tue, Apr 26, 2011 at 2:42 PM, marc betts <marc...@gmail.com> wrote:
>
> browser.div(:id=>"some_div").element.drag_and_drop_on(browser.div(:id=>"some_other_div").element)
>

When you call Watir::Element#element to fetch the underlying
Selenium::WebDriver::Element instance, you're using a private API that
was changed in 0.2.1:

https://github.com/jarib/watir-webdriver/commit/7cee77a7b81d87df1392c43d402d262f5df9ecac

You can still do this by replacing the #element calls in your code
with #wd, but keep in mind that this API is not public (it's marked as
private in the documentation).

We should probably add Watir::Element#drag_and_drop_on directly - feel
free to file that to the tracker:

https://github.com/jarib/watir-webdriver/issues

marc

unread,
Apr 26, 2011, 9:15:03 AM4/26/11
to Watir General
Jari,
Thanks for the quick reply. I've added the issue to the tracker.
Marc

On Apr 26, 9:04 am, Jari Bakken <jari.bak...@gmail.com> wrote:
> Hi,
>
> On Tue, Apr 26, 2011 at 2:42 PM, marc betts <marcbe...@gmail.com> wrote:
>
> > browser.div(:id=>"some_div").element.drag_and_drop_on(browser.div(:id=>"som e_other_div").element)
>
> When you call Watir::Element#element to fetch the underlying
> Selenium::WebDriver::Element instance, you're using a private API that
> was changed in 0.2.1:
>
>  https://github.com/jarib/watir-webdriver/commit/7cee77a7b81d87df1392c...
Reply all
Reply to author
Forward
0 new messages