appium / appium-windows-driver

Appium's interface to WindowsAppDriver provided by Microsoft
Apache License 2.0
131 stars 35 forks source link

ActionChains - tap element on Windows app fails 'object has no attribute 'execute'' / 'REQUEST FAILED WITH STATUS CODE 501' #252

Closed Anna-Ku closed 7 months ago

Anna-Ku commented 8 months ago

Appium-Python-Client==4.0.0 removed TouchAction so I trying to tap element with ActionChains.

Option 1 - ends with error 'object has no attribute 'execute'' touch_input = PointerInput(interaction.POINTERTOUCH, 'touch') actions = ActionChains(self.driver.base_driver()) actions.w3c_actions = ActionBuilder(self, mouse=touch_input) actions.w3c_actions.pointer_action.move_to(element) actions.w3c_actions.pointer_action.pointer_down() actions.w3c_actions.pointer_action.pause(0.1) actions.w3c_actions.pointer_action.release() actions.perform()

output_no_execute_attribute.txt

Option 2 - ends with error 'REQUEST FAILED WITH STATUS CODE 501' action = ActionChains(self.driver_) action.move_to_element(element) action.double_click() action.perform()

output_error_501.txt

Environment details: OS - Windows 10 Pro Python 3.12 selenium==4.18.1 windows driver - windows@2.12.18 [installed (npm)] appium == 2.5.1

Please assist on how this issue can be resolved.

bwomsm1 commented 8 months ago

@KazuCocoa can you please help with that issue? We upgraded the python libraries to latest appium == 2.5.1 server and it seems that TouchAction was removed. We are trying to perform doubleTap on windows applications.

Appium-Python-Client==4.0.0

KazuCocoa commented 8 months ago

https://github.com/appium/appium-windows-driver?tab=readme-ov-file#windows-click didn't help?

bwomsm1 commented 8 months ago

https://github.com/appium/appium-windows-driver?tab=readme-ov-file#windows-click didn't help?

@KazuCocoa , we tried as follow: element.click(times=2)

But we are getting this error: TypeError: WebElement.click() got an unexpected keyword argument 'times'

I can confirm that element object is from type WebElement.

bwomsm1 commented 8 months ago

@KazuCocoa I can confirm that the problems started once we upgraded to Appium-Python-Client=4.0.0 from Appium-Python-Client=3.2.1

KazuCocoa commented 8 months ago

No, it is windows: click like mobile: in Android/iOS. driver.execute_script("windows: click", {"elementId": "<element id>", "times": 2}) like that. This was because legacy method removal, which does not exist in W3C WebDriver protocol. We provide extension commands such as windows: to cover such cases as possible in w3c protocol era for legacy env.

Anna-Ku commented 7 months ago

@KazuCocoa driver.execute_script("windows: click", {"elementId": "", "times": 2}) solved this issue, thank you!

bwomsm1 commented 7 months ago

@KazuCocoa, we can close the ticket from our side. thank you