While trying to automate using webdriver and python I am facing the following :

Simple click is working without class:

element.click()

But trying to click is not working using action chains class:

from selenium.webdriver.common.action_chains import ActionChains

action = ActionChains()

action.click(element).perform()

Similarly, trying to not working using action chains class:

action.drag_drop_by_offset(element,"0","100").perform()

action.drag_drop(element,element2).perform()

Using ActionChains gives a stale element exception.

Is there any other way to perform these operations like move_to, mouse_press, mouse_release, drag_drop etc. without ActionChains class

Further – working directly with driver commands:

from selenium.webdriver.remote.command import Command

driver.execute(Command.CLICK_ELEMENT, {"id":getattr(element,"id")})

But this does not:

from selenium.webdriver.remote.command import Command

driver.execute(Command.MOVE_TO, {"id":getattr(element,"id")})

driver.execute(Command.MOUSE_DOWN, {})

driver.execute(Command.MOVE_TO, {"id":getattr(element2,"id")})

driver.execute(Command.MOUSE_UP, {})

Any suggestions?



Source link https://sqa.stackexchange.com/questions/34317/selenium--driver-issue-with-action-chains-drag-drop-when---wor

LEAVE A REPLY

Please enter your comment!
Please enter your name here