Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ActionChains does not reset actions #7913

Closed
bayilyas opened this issue Jan 5, 2020 · 8 comments · Fixed by #7943
Closed

ActionChains does not reset actions #7913

bayilyas opened this issue Jan 5, 2020 · 8 comments · Fixed by #7943

Comments

@bayilyas
Copy link
Contributor

bayilyas commented Jan 5, 2020

🐛 Bug Report

ActionChains does not reset actions.

To Reproduce

Drag and drop

Detailed steps to reproduce the behavior:

All elements drag and drop every loop iteration

Expected behavior

Reset actions and do one drag and drop for each iteration

Test script or set of commands reproducing this issue

from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains

driver = webdriver.Chrome()
actions = ActionChains(driver)

driver.get('http://www.dhtmlgoodies.com/scripts/drag-drop-custom/demo-drag-drop-3.html')

countries = {
    "Italy": "Rome",
    "Spain": "Madrid",
    "Norway": "Oslo",
    "Denmark": "Copenhagen",
    "South Korea": "Seoul",
    "Sweden": "Stockholm",
    "United States": "Washington",
}

for country in countries:
    country_box = driver.find_element_by_xpath(f"//div[.='{country}']")
    capital_box = driver.find_element_by_xpath(f"//div[.='{countries[country]}' and contains(@id, 'box')]")
    actions.drag_and_drop(capital_box, country_box).perform()
    actions.reset_actions()

Environment

OS: macOS Catalina Version 10.15.2
Language Bindings version: Python 3.141.0

Browser: Chrome
Browser version: 79.0.3945.88 (Official Build) (64-bit)
Browser Driver version: ChromeDriver 79.0.3945.36

Browser: Firefox
Browser version: 72.0.1 (64-bit)
Browser Driver version: geckodriver v0.26.0, v0.21.0

@ghost ghost added the needs-triaging label Jan 5, 2020
@isaulv
Copy link
Contributor

isaulv commented Jan 9, 2020

@bayilyas Using the latest public release of the python bindings, this worked pretty well.
Can you verify that you're using the latest stable python release (3.141.0)?

@bayilyas
Copy link
Contributor Author

bayilyas commented Jan 9, 2020

Yes, I'm using 3.141.0
You can see difference using ActionChains(driver) in every iteration:

for country in countries:
    country_box = driver.find_element_by_xpath(f"//div[.='{country}']")
    capital_box = driver.find_element_by_xpath(f"//div[.='{countries[country]}' and contains(@id, 'box')]")
    ActionChains(driver).drag_and_drop(capital_box, country_box).perform()
    # actions.drag_and_drop(capital_box, country_box).perform()
    # actions.reset_actions()

@isaulv
Copy link
Contributor

isaulv commented Jan 15, 2020

@bayilyas I have confirmed this is a bug. It seems that the driver builds up a list internally instead of the code itself so this may be driver bug. :/

@bayilyas
Copy link
Contributor Author

@Dude-x Same behavior with geckodriver 0.26.0 and 0.21.0 versions

@isaulv
Copy link
Contributor

isaulv commented Jan 16, 2020

@bayilyas It is possible that the command to reset actions is flawed in the Python driver. Can you test another language binding like Java?

@bayilyas
Copy link
Contributor Author

@Dude-x No issue with Java

@isaulv
Copy link
Contributor

isaulv commented Jan 16, 2020

@bayilyas I've have studied the Java source code and it does not have a method to reset actions, despite building up a list. Also the list it uses internally is "ummodifiable".

AutomatedTester added a commit that referenced this issue Feb 14, 2020
* Fix clear actions in ActionChains

Clear actions in ActionChains object after perform

Fixes #7913

* Delete droppableItemsMulti.html

Co-authored-by: David Burns <david.burns@theautomatedtester.co.uk>
@lock
Copy link

lock bot commented Mar 17, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Mar 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants