admc / wd

A node.js client for webdriver/selenium 2.
Other
1.53k stars 402 forks source link

Drag and drop in promiseRemote #394

Closed hy9be closed 9 years ago

hy9be commented 9 years ago

A click action in promise without chain is like this:

.then (function () {
    return browser.elementById('someID');
}).then (function (el) { 
    return browser.clickElement(el); 
})

What about I want to do a drag and drop action, for which the function has two augments? I stuck at something like this:

.then (function () {
    return browser.elementById('someID_1');
}).then (function (el1) { 
    return browser.elementById('someID_2'); 
}).then (function (???)) {
    //???
}
sebv commented 9 years ago

Q.all

Please read promise doc here: https://github.com/kriskowal/q

sebv commented 9 years ago

Q.all

Please read promise doc here: https://github.com/kriskowal/q

hy9be commented 9 years ago

Thanks! I will give it a try.

hy9be commented 9 years ago

@sebv btw, it looks wd does not even have a dnd api according to the document here: https://github.com/admc/wd/blob/master/doc/api.md. Is that a known fact? If it is, then I may need to use the mousedown and mouseup to imitate a dnd?

sebv commented 9 years ago

https://github.com/admc/wd/blob/master/examples/promise/drag-n-drop.js

sebv commented 9 years ago

There is no Drag and drop api in JsonWire, there no portable way to write it, really it depends on your page.

hy9be commented 9 years ago

Got you. Appreciate your help!