Hello,
I want to know if Oxygen supported to action ‘drag and drop’ .
example: https://screencast.com/t/LJmd2pWt
Hi Dor,
Is this for mobile or web (desktop browser) tests?
Its for web application tests.
Drag and Drop functionality is not exposed currently through Oxygen (we will add it in the next version).
But it’s possible to use the underlying webdriver directly.
This will drop grey rectangle into red square. You’ll see “Dropped” written in one of the edit fields after the rectangle was dropped.
dragAndDrop command receives locator for the element you want to drop as first argument, and the locator of the element where to drop to as second argument.
Note that locators here are not Oxygen locators. If you want to find element by ID then prepend # to the id (like the first argument in the example bellow). XPath (like the second argument in the example below) is identical to how it’s used in Oxygen.
web.init();
web.open('http://webdriverjs.christian-bromann.com/');
web.driver().dragAndDrop('#overlay', '/html/body/section/div[1]');
web.pause(10000);
Code sample is working
The code described is working correctly
Thank you!
Hello @romovs,
I tried the code and got the following error. Is there something else I need to do?
Initializing…
Starting iteration #1
SCRIPT_ERROR - web.driver(…).dragAndDrop is not a function at line 3
Test finished with status --> FAILED
Thanks
I figured it out. I read the docs
This worked:
web.init();
web.open(‘http://webdriverjs.christian-bromann.com/’);
web.dragAndDrop(‘id=overlay’, ‘/html/body/section/div[1]’);
web.pause(10*1000);
Thanks
Yes, it was updated due to this request
One more update:
The webdriverio commands can be executed using the following command
web.getDriver().
The old command -web.driver().has been depricated
we will update the documentation soon