appium / appium-mac2-driver

Next-gen Appium macOS driver, backed by Apple XCTest
Apache License 2.0
115 stars 24 forks source link

Element fails to be clicked EVEN THOUGH it is detected. #220

Open sksang opened 10 months ago

sksang commented 10 months ago

I am using appium-mac2-driver. It is detecting a button element but not clicking the same. Also the screenshot() method works successfully on the element and saves the correct screenshot of the element. So no problem with the element detection. Here is the serve log:

[HTTP] --> POST /session/c747bce2-9935-42e6-9c01-e5395554d98d/element/A49AC7EC-B2CB-4AD9-BA89-B360A5EA6E4F/click [HTTP] {"id":"A49AC7EC-B2CB-4AD9-BA89-B360A5EA6E4F"} [Mac2Driver@b296 (c747bce2)] Driver proxy active, passing request on via HTTP proxy [debug] [WD Proxy] Matched '/session/c747bce2-9935-42e6-9c01-e5395554d98d/element/A49AC7EC-B2CB-4AD9-BA89-B360A5EA6E4F/click' to command name 'click' [debug] [WD Proxy] Proxying [POST /session/c747bce2-9935-42e6-9c01-e5395554d98d/element/A49AC7EC-B2CB-4AD9-BA89-B360A5EA6E4F/click] to [POST http://127.0.0.1:10100/session/BC64C1FB-E907-42AB-8379-F7EAA5582187/element/A49AC7EC-B2CB-4AD9-BA89-B360A5EA6E4F/click] with body: {"id":"A49AC7EC-B2CB-4AD9-BA89-B360A5EA6E4F"} [debug] [WebDriverAgentMac] [xcodebuild] t = 9.63s Find the "Sign in" Button [debug] [WebDriverAgentMac] [xcodebuild] t = 9.63s Requesting snapshot of accessibility hierarchy for app with pid 831 [debug] [WebDriverAgentMac] [xcodebuild] t = 9.76s Find: Descendants matching type Any [debug] [WebDriverAgentMac] [xcodebuild] t = 9.76s Find: Elements matching predicate 'BLOCKPREDICATE(0x6000007639f0)' [debug] [WebDriverAgentMac] [xcodebuild] t = 9.76s Find: Identity Binding [debug] [WebDriverAgentMac] [xcodebuild] t = 9.77s Click "Sign in" Button [debug] [WebDriverAgentMac] [xcodebuild] t = 9.77s Wait for com.amazon.aiv.AIVApp to idle [debug] [WebDriverAgentMac] [xcodebuild] t = 9.77s Find the "Sign in" Button [debug] [WebDriverAgentMac] [xcodebuild] t = 9.77s Requesting snapshot of accessibility hierarchy for app with pid 831 [debug] [WebDriverAgentMac] [xcodebuild] t = 9.90s Find: Descendants matching type Any [debug] [WebDriverAgentMac] [xcodebuild] t = 9.90s Find: Elements matching predicate 'BLOCKPREDICATE(0x6000007639f0)' [debug] [WebDriverAgentMac] [xcodebuild] t = 9.90s Find: Identity Binding [debug] [WebDriverAgentMac] [xcodebuild] t = 9.91s Check for interrupting elements affecting "Sign in" Button

Here is the python error log:

Traceback (most recent call last): File "/Users/saurabhkoli/Documents/Appium_MacOS_Automation/MacOS_Apps_Automation/TestAppiumMac/Test_AppiumMac.py", line 53, in element.click() File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/selenium/webdriver/remote/webelement.py", line 94, in click self._execute(Command.CLICK_ELEMENT) File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/selenium/webdriver/remote/webelement.py", line 395, in _execute return self._parent.execute(command, params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 345, in execute self.error_handler.check_response(response) File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/appium/webdriver/errorhandler.py", line 122, in check_response raise exception_class(msg=message, stacktrace=format_stacktrace(stacktrace)) selenium.common.exceptions.WebDriverException: Message: Could not proxy command to the remote server. Original error: timeout of 240000ms exceeded Stacktrace: ProxyRequestError: Could not proxy command to the remote server. Original error: timeout of 240000ms exceeded at WDAMacProxy.proxy (/opt/homebrew/lib/node_modules/appium/node_modules/@appium/base-driver/lib/jsonwp-proxy/proxy.js:280:13) at runNextTicks (node:internal/process/task_queues:60:5) at listOnTimeout (node:internal/timers:540:9) at processTimers (node:internal/timers:514:7) at ProtocolConverter.convertAndProxy (/opt/homebrew/lib/node_modules/appium/node_modules/@appium/base-driver/lib/jsonwp-proxy/protocol-converter.js:266:12) at WDAMacProxy.proxyCommand (/opt/homebrew/lib/node_modules/appium/node_modules/@appium/base-driver/lib/jsonwp-proxy/proxy.js:336:12) at WDAMacProxy.proxyCommand (/Users/saurabhkoli/.appium/node_modules/appium-mac2-driver/lib/wda-mac.js:60:12) at WDAMacProxy.proxyReqRes (/opt/homebrew/lib/node_modules/appium/node_modules/@appium/base-driver/lib/jsonwp-proxy/proxy.js:410:32)

KazuCocoa commented 10 months ago

This usually means the XCTest framework (by Apple) did not respond in the timeout, so Appium/mac2 driver did not respond.

Could not proxy command to the remote server. Original error: timeout of 240000ms exceeded
Stacktrace:

Potentially it is Apple's XCTest framework internal. You could write similar test with XCTest I guess. Alternatively, https://github.com/appium/appium-mac2-driver#macos-tap with x.y coordinate or W3C action with x, y coordinate may help