-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Fix clear actions in ActionChains #7943
Fix clear actions in ActionChains #7943
Conversation
Clear actions in ActionChains object after perform Fixes #7913
Suppose you run
|
For the case you want to run |
@bayilyas seems like you need to merge master. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -53,26 +53,27 @@
def key_action(self): def key_action(self):
return self._key_action return self._key_action
@Property @Property
def pointer_action(self): def pointer_action(self):
return self._pointer_action return self._pointer_action
def add_key_input(self, name): def add_key_input(self, name):
new_input = KeyInput(name) new_input = KeyInput(name)
self._add_input(new_input) self._add_input(new_input)
return new_input return new_input
def add_pointer_input(self, kind, name): def add_pointer_input(self, kind, name):
new_input = PointerInput(kind, name) new_input = PointerInput(kind, name)
self._add_input(new_input) self._add_input(new_input)
return new_input return new_input
def perform(self): def perform(self):
enc = {"actions": []} enc = {"actions": []}
for device in self.devices: for device in self.devices:
encoded = device.encode() encoded = device.encode()
if encoded['actions']: if encoded['actions']:
enc["actions"].append(encoded) enc["actions"].append(encoded)
device.actions = []
self.driver.execute(Command.W3C_ACTIONS, enc) self.driver.execute(Command.W3C_ACTIONS, enc)
def clear_actions(self): def clear_actions(self):
will the fix be available in v4? and is there any way to get this fix now? |
nvm just added your change in the code thank you so much |
I did commit to clear Prepared action can be reused several times and |
Clear actions in ActionChains object after performing
Fixes #7913
Description
ActionChains
assigned to a variable does not clear previous actions afterperform
andreset_actions
does not solve the issue.Motivation and Context
Assigning ActionChains to a variable and using it in different actions causes a repetition of all previous actions. The example below, in the second drag and drop, actions will be executed for
element1
andelement2
and not only for theelement2
. Clearingdevice.action
in theperform
method solve the issue.Not: clearing actions on the remote end with
driver.execute(Command.W3C_CLEAR_ACTIONS)
can be also executed in thepefrom
method.Types of changes
Checklist