You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
"Drag and Drop" function not supported in selenium2library ? #60
I have a requirement to automate Dragging one element from source and dropping it into a target element. I see that drag and drop is not supported in selenium2library. Any alternatives? I am thinking of copying the same from Selenium1.
This functionality is supported under Selenium 2 / WebDriver (using action_chains). It's easy enough to create a keyword for it with the only question should we keep the function call the same as the old selenium library,
Yeah I think copying from selenium 1 library wound be the best way to go. However im not sure if the action chains API is the same between selenium 1 and webdriver.
I have a requirement to automate Dragging one element from source and dropping it into a target element. I see that drag and drop is not supported in selenium2library. Any alternatives? I am thinking of copying the same from Selenium1.
-Mamatha
Reply to this email directly or view it on GitHub: #60
Just to bring this issue to closure, documenting what we have implemented in our project and works fine.
Edited element.py and added the following keyword(function)
def drag_and_drop(self, source, target):
"""Drags element identified with locator by movement
`movement is a string in format "+70 -300" interpreted as pixels in
relation to elements current position.
"""
actionChains = ActionChains(self)
element = self._element_find(source,True,True)
target = self._element_find(target,True,True)
ActionChains(self._current_browser()).drag_and_drop(element, target).perform()
in such a way it would break for existing selenium users that were using offsets, but it keep things in line with web driver and will be easier for new users coming from web driver.
FYI, for issues with drag & drop, it would help if one indicates which browser. There are some browser specific issues with WebDriver drag & drop, and SafariDriver has no support for it natively (one would have to use javascript fallback).
Also forgot to mention, any specific public site (or custom HTML file(s)) for testing the issue against? Or is it generally reproducible for any given site using the library and FF 21? It would help to provide the test site or files to reproduce the issue against.
And also, if one is able to use Selenium 2 / WebDriver directly outside of Robot Framework, it also helps to see if issue reproduces there as well to narrow down the problem of whether it is with this library or Selenium itself (or the Python bindings to it). If it is the latter than the former, you'd then have to raise the issue with the Selenium team itself (submit Selenium issue or post to their Google discussion groups).
Nah sorry, it is an internal only website, cannot provide it outside the company :(
I use selenium2library in a robot test (run through RIDE). All I've changed is upgraded from importing seleniumlibrary to selenium2library. Now drag and drop fails (and A LOT of other keywords but I am slowly fixing those up).
Activity
emanlove commentedon Jun 5, 2012
This functionality is supported under Selenium 2 / WebDriver (using action_chains). It's easy enough to create a keyword for it with the only question should we keep the function call the same as the old selenium library,
drag_and_drop(self, locator, movement=None, target=None)or should it directly correspond with selenium call, such as
drag_and_drop(self, source, target)*which I think is cleaner but might break what people are used to. We could leave the drag and drop call as is and add functions like
drag_and_drop_on_target(self, source, target)drag_and_drop_by_offset(self, source, xoffset, yoffset)for which the new selenium2library keyword, 'Drag and Drop', could call depending on the movement/target parameters or could be called directly.
* where
sourceis the same aslocatorj1z0 commentedon Jun 5, 2012
Yeah I think copying from selenium 1 library wound be the best way to go. However im not sure if the action chains API is the same between selenium 1 and webdriver.
Cheers,
Jeremy
On Jun 5, 2012, at 15:53, mamathanagreply@reply.github.com wrote:
mamathanag commentedon Jun 12, 2012
@emanlove @j1z0,
Just to bring this issue to closure, documenting what we have implemented in our project and works fine.
Edited element.py and added the following keyword(function)
def drag_and_drop(self, source, target):
"""Drags element identified with
locatorbymovementj1z0 commentedon Jun 30, 2012
I believe we should just follow what is in webdriver, which is different from what was in selenium. In web driver it is:
in such a way it would break for existing selenium users that were using offsets, but it keep things in line with web driver and will be easier for new users coming from web driver.
dkoudrin commentedon Jun 5, 2013
Drag and Drop in Selenium2Library is NOT working for me... It used to work fine in SeleniumLibrary.
daluu commentedon Jun 6, 2013
FYI, for issues with drag & drop, it would help if one indicates which browser. There are some browser specific issues with WebDriver drag & drop, and SafariDriver has no support for it natively (one would have to use javascript fallback).
dkoudrin commentedon Jun 6, 2013
Hi, sorry, firefox 21 is the browser.
daluu commentedon Jun 6, 2013
Also forgot to mention, any specific public site (or custom HTML file(s)) for testing the issue against? Or is it generally reproducible for any given site using the library and FF 21? It would help to provide the test site or files to reproduce the issue against.
And also, if one is able to use Selenium 2 / WebDriver directly outside of Robot Framework, it also helps to see if issue reproduces there as well to narrow down the problem of whether it is with this library or Selenium itself (or the Python bindings to it). If it is the latter than the former, you'd then have to raise the issue with the Selenium team itself (submit Selenium issue or post to their Google discussion groups).
dkoudrin commentedon Jun 6, 2013
Nah sorry, it is an internal only website, cannot provide it outside the company :(
I use selenium2library in a robot test (run through RIDE). All I've changed is upgraded from importing seleniumlibrary to selenium2library. Now drag and drop fails (and A LOT of other keywords but I am slowly fixing those up).
ahitrin commentedon Jun 6, 2013
@dkoudrin try to run your tests with older version of Firefox (19 or 20). The problem is that Firefox 21 currently is not fully supported by Selenium (see https://code.google.com/p/selenium/source/browse/py/CHANGES for more info).
dkoudrin commentedon Jun 6, 2013
Oh really? Well that's bad news, the whole point of me upgrading to selenium2 was so I could run tests on the latest firefox.
ahitrin commentedon Jun 6, 2013
@dkoudrin You can use the almost latest version, so the news are no so bad :)
dkoudrin commentedon Jun 6, 2013
Yes, but 'almost' doesn't satisfy my boss's requirements...