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

[Python] Clear _actions after performing action_chains #99

Closed
wants to merge 1 commit into from
Closed

[Python] Clear _actions after performing action_chains #99

wants to merge 1 commit into from

Conversation

bayandin
Copy link
Contributor

This will make possible to reuse ActionChains object after perform for other actions wihout creating a new object.

case:

ac = ActionChains(driver)
ac.move_to_element(some_element).click().perform()
# ac._actions contains moving and clicking
ac.send_keys(some_keys).perform()
# ac._actions contains moving, clicking and sending keys, but I expect, that it contain only sending keys action.

In general, it will break a backward compatibility.

Another solution is to add a new method clear witch will be clear self._actions list.

CLA signed as Alexander Bayandin

This will make possible to reuse `ActionChains` object after perform  for other actions wihout creating a new object.

case:
```
ac = ActionChains(driver)
ac.move_to_element(some_element).click().perform()
# ac._actions contains moving and clicking
ac.send_keys(some_keys).perform()
# ac._actions contains moving, clicking and sending keys, but I expect, that it contain only sending keys action.
```

Another solution is to add a new method `clear` witch will be clear self._actions list.
@AutomatedTester
Copy link
Member

Unfortunately what we have is by design so that people can reuse actions if they want. Clearing an action after use means that people will always have to recreate things which is far from ideal

Thanks for the patch though.

@bayandin
Copy link
Contributor Author

Ok. I get it.
I added a new method for clearing actions on demand (#100). Hope it will not break design.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants