Issues with Timeout and Element Location Errors Using Appium with WebDriverAgent

Hello Appium Community,

I am encountering several issues while running tests using Appium with WebDriverAgent on iOS. Below, I’ve detailed the problems along with the relevant parts of my code and the errors I’m receiving.

Environment:

Appium version: 2.6.0

  • Device/Emulator details: iphone 12 with iOS 17.5.1 (real device)
  • Code language and framework: Python with PyTest

Issues:

  1. Timeout Errors: I frequently encounter timeouts exceeding 240000ms when trying to capture screenshots or interact with elements.
  2. NoSuchElementError: Errors are thrown indicating that elements cannot be located using the given search parameters.
  3. MaxRetryError and ProtocolError: These errors occur when attempting to save screenshots, suggesting potential network or configuration issues.
  4. Unknown Server-side Error: General server-side errors without specific details.

appium log:

[XCUITest] Executing command ‘getScreenshot’
[WD Proxy] Error: timeout of 240000ms exceeded
[WD Proxy] at createError (/Applications/Appium Server GUI.app/Contents/Resources/app/node_modules/appium/node_modules/axios/lib/core/createError.js:16:15)
[WD Proxy] at RedirectableRequest.handleRequestTimeout (/Applications/Appium Server GUI.app/Contents/Resources/app/node_modules/appium/node_modules/axios/lib/adapters/http.js:280:16)
[WD Proxy] at RedirectableRequest.emit (events.js:310:20)
[WD Proxy] at Timeout._onTimeout (/Applications/Appium Server GUI.app/Contents/Resources/app/node_modules/appium/node_modules/follow-redirects/index.js:166:12)
[WD Proxy] at listOnTimeout (internal/timers.js:549:17)
[WD Proxy] at processTimers (internal/timers.js:492:7)
[XCUITest] Taking screenshot with WDA
[WD Proxy] Matched ‘/screenshot’ to command name ‘getScreenshot’
[WD Proxy] Proxying [GET /screenshot] to [GET
linkhttp://127.0.0.1:8100/session/A635841A-56CE-415D-94E0-4A80485340AB/screenshot] with no body
[W3C (2a66ed3b)] Encountered internal error running command: NoSuchElementError: An element could not be located on the page using the given search parameters.
[W3C (2a66ed3b)] at XCUITestDriver.doNativeFind (/Applications/Appium Server GUI.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/lib/commands/find.js:130:11)
[W3C (2a66ed3b)] at runMicrotasks ()
[W3C (2a66ed3b)] at processTicksAndRejections (internal/process/task_queues.js:97:5)
[W3C (2a66ed3b)] at XCUITestDriver.findNativeElementOrElements (/Applications/Appium Server GUI.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/lib/commands/find.js:90:10)
[W3C (2a66ed3b)] at XCUITestDriver.findElOrEls (/Applications/Appium Server GUI.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/lib/commands/find.js:23:12)
[W3C (2a66ed3b)] at XCUITestDriver.findElOrElsWithProcessing (/Applications/Appium Server GUI.app/Contents/Resources/app/node_modules/appium/node_modules/appium-base-driver/lib/basedriver/commands/find.js:33:12)
[W3C (2a66ed3b)] at XCUITestDriver.findElement (/Applications/Appium Server GUI.app/Contents/Resources/app/node_modules/appium/node_modules/appium-base-driver/lib/basedriver/commands/find.js:53:10)
[WD Proxy] Error: timeout of 240000ms exceeded
[WD Proxy] at createError (/Applications/Appium Server GUI.app/Contents/Resources/app/node_modules/appium/node_modules/axios/lib/core/createError.js:16:15)
[WD Proxy] at RedirectableRequest.handleRequestTimeout (/Applications/Appium Server GUI.app/Contents/Resources/app/node_modules/appium/node_modules/axios/lib/adapters/http.js:280:16)
[WD Proxy] at RedirectableRequest.emit (events.js:310:20)
[WD Proxy] at Timeout._onTimeout (/Applications/Appium Server GUI.app/Contents/Resources/app/node_modules/appium/node_modules/follow-redirects/index.js:166:12)
[WD Proxy] at listOnTimeout (internal/timers.js:549:17)
[WD Proxy] at processTimers (internal/timers.js:492:7)
[XCUITest] Error getting screenshot: An unknown server-side error occurred while processing the command. Original error: Could not proxy command to the remote server. Original error: timeout of 240000ms exceeded
[XCUITest] Taking screenshot with WDA
[WD Proxy] Matched ‘/screenshot’ to command name ‘getScreenshot’
[WD Proxy] Proxying [GET /screenshot] to [GET http://127.0.0.1:8100/session/A635841A-56CE-415D-94E0-4A80485340AB/screenshot] with no body
[WD Proxy] Error: timeout of 240000ms exceeded
[WD Proxy] at createError (/Applications/Appium Server GUI.app/Contents/Resources/app/node_modules/appium/node_modules/axios/lib/core/createError.js:16:15)
[WD Proxy] at RedirectableRequest.handleRequestTimeout (/Applications/Appium Server GUI.app/Contents/Resources/app/node_modules/appium/node_modules/axios/lib/adapters/http.js:280:16)
[WD Proxy] at RedirectableRequest.emit (events.js:310:20)
[WD Proxy] at Timeout._onTimeout (/Applications/Appium Server GUI.app/Contents/Resources/app/node_modules/appium/node_modules/follow-redirects/index.js:166:12)
[WD Proxy] at listOnTimeout (internal/timers.js:549:17)
[WD Proxy] at processTimers (internal/timers.js:492:7)
[HTTP] ← GET /wd/hub/session/2a66ed3b-c832-472a-9083-b68a8fb27ff8/screenshot - - ms - -
[HTTP]
[HTTP] → GET /wd/hub/session/2a66ed3b-c832-472a-9083-b68a8fb27ff8/screenshot
[HTTP] {}
[W3C (2a66ed3b)] Calling AppiumDriver.getScreenshot() with args: [“2a66ed3b-c832-472a-9083-b68a8fb27ff8”]
[XCUITest] Executing command ‘getScreenshot’
[XCUITest] Taking screenshot with WDA
[WD Proxy] Matched ‘/screenshot’ to command name ‘getScreenshot’
[WD Proxy] Proxying [GET /screenshot] to [GET http://127.0.0.1:8100/session/A635841A-56CE-415D-94E0-4A80485340AB/screenshot] with no body
[WD Proxy] Error: timeout of 240000ms exceeded
[WD Proxy] at createError (/Applications/Appium Server GUI.app/Contents/Resources/app/node_modules/appium/node_modules/axios/lib/core/createError.js:16:15)
[WD Proxy] at RedirectableRequest.handleRequestTimeout (/Applications/Appium Server GUI.app/Contents/Resources/app/node_modules/appium/node_modules/axios/lib/adapters/http.js:280:16)
[WD Proxy] at RedirectableRequest.emit (events.js:310:20)
[WD Proxy] at Timeout._onTimeout (/Applications/Appium Server GUI.app/Contents/Resources/app/node_modules/appium/node_modules/follow-redirects/index.js:166:12)
[WD Proxy] at listOnTimeout (internal/timers.js:549:17)
[WD Proxy] at processTimers (internal/timers.js:492:7)
[XCUITest] Taking screenshot with WDA
[WD Proxy] Matched ‘/screenshot’ to command name ‘getScreenshot’
[WD Proxy] Proxying [GET /screenshot] to [GET linkhttp://127.0.0.1:8100/session/A635841A-56CE-415D-94E0-4A80485340AB/screenshot] with no body
[W3C (2a66ed3b)] Encountered internal error running command: UnknownError: An unknown server-side error occurred while processing the command. Original error: Could not proxy command to the remote server. Original error: timeout of 240000ms exceeded
[W3C (2a66ed3b)] at JWProxy.command (/Applications/Appium Server GUI.app/Contents/Resources/app/node_modules/appium/node_modules/appium-base-driver/lib/jsonwp-proxy/proxy.js:274:13)
[W3C (2a66ed3b)] at runMicrotasks ()
[W3C (2a66ed3b)] at processTicksAndRejections (internal/process/task_queues.js:97:5)
[W3C (2a66ed3b)] at XCUITestDriver.proxyCommand (/Applications/Appium Server GUI.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/lib/commands/proxy-helper.js:96:12)
[W3C (2a66ed3b)] at getScreenshotFromWDA (/Applications/Appium Server GUI.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/lib/commands/screenshots.js:11:18)
[W3C (2a66ed3b)] at wrapped (/Applications/Appium Server GUI.app/Contents/Resources/app/node_modules/appium/node_modules/asyncbox/lib/asyncbox.js:60:13)
[W3C (2a66ed3b)] at retry (/Applications/Appium Server GUI.app/Contents/Resources/app/node_modules/appium/node_modules/asyncbox/lib/asyncbox.js:43:13)
[W3C (2a66ed3b)] at retryInterval (/Applications/Appium Server GUI.app/Contents/Resources/app/node_modules/appium/node_modules/asyncbox/lib/asyncbox.js:70:10)
[W3C (2a66ed3b)] at XCUITestDriver.getScreenshot (/Applications/Appium Server GUI.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/lib/commands/screenshots.js:42:10)
[WD Proxy] Error: timeout of 240000ms exceeded
[WD Proxy] at createError (/Applications/Appium Server GUI.app/Contents/Resources/app/node_modules/appium/node_modules/axios/lib/core/createError.js:16:15)
[WD Proxy] at RedirectableRequest.handleRequestTimeout (/Applications/Appium Server GUI.app/Contents/Resources/app/node_modules/appium/node_modules/axios/lib/adapters/http.js:280:16)
[WD Proxy] at RedirectableRequest.emit (events.js:310:20)
[WD Proxy] at Timeout._onTimeout (/Applications/Appium Server GUI.app/Contents/Resources/app/node_modules/appium/node_modules/follow-redirects/index.js:166:12)
[WD Proxy] at listOnTimeout (internal/timers.js:549:17)
[WD Proxy] at processTimers (internal/timers.js:492:7)
[XCUITest] Error getting screenshot: An unknown server-side error occurred while processing the command. Original error: Could not proxy command to the remote server. Original error: timeout of 240000ms exceeded
[XCUITest] Taking screenshot with WDA
[WD Proxy] Matched ‘/screenshot’ to command name ‘getScreenshot’
[WD Proxy] Proxying [GET /screenshot] to [GET http://127.0.0.1:8100/session/A635841A-56CE-415D-94E0-4A80485340AB/screenshot] with no body
[HTTP] ← GET /wd/hub/session/2a66ed3b-c832-472a-9083-b68a8fb27ff8/screenshot - - ms - -
[HTTP]
[HTTP] → GET /wd/hub/session/2a66ed3b-c832-472a-9083-b68a8fb27ff8/screenshot

python log:

Failed to save screenshot: argument of type ‘MaxRetryError’ is not iterable Cannot process image as the screenshot file does not exist at /Users/ynetautomation/Desktop/ynet code azure/YnetAutomatzia/target/screenshots/2024-05-28_18-56-50_TestHomePageJson.test_compare_componentes_at_home_page_to_json[100-components_to_run100].png Failed to query app state: argument of type ‘ProtocolError’ is not iterable FFailed to save screenshot: argument of type ‘MaxRetryError’ is not iterable Cannot process image as the screenshot file does not exist at /Users/ynetautomation/Desktop/ynet code azure/YnetAutomatzia/target/screenshots/2024-05-28_19-56-55_TestHomePageJson.test_compare_componentes_at_home_page_to_json[101-components_to_run101].png Failed to query app state: argument of type ‘ProtocolError’ is not iterable FFailed to save screenshot: argument of type ‘MaxRetryError’ is not iterable Cannot process image as the screenshot file does not exist at /Users/ynetautomation/Desktop/ynet code azure/YnetAutomatzia/target/screenshots/2024-05-28_20-57-00_TestHomePageJson.test_compare_componentes_at_home_page_to_json[102-components_to_run102].png Failed to query app state: argument of type ‘ProtocolError’ is not iterable FFailed to save screenshot: argument of type ‘MaxRetryError’ is not iterable Cannot process image as the screenshot file does not exist at /Users/ynetautomation/Desktop/ynet code azure/YnetAutomatzia/target/screenshots/2024-05-28_21-57-05_TestHomePageJson.test_compare_componentes_at_home_page_to_json[103-components_to_run103].png Failed to query app state: argument of type ‘ProtocolError’ is not iterable FFailed to save screenshot: argument of type ‘MaxRetryError’ is not iterable Cannot process image as the screenshot file does not exist at /Users/ynetautomation/Desktop/ynet code azure/YnetAutomatzia/target/screenshots/2024-05-28_22-57-10_TestHomePageJson.test_compare_componentes_at_home_page_to_json[104-components_to_run104].png Failed to query app state: argument of type ‘ProtocolError’ is not iterable FFailed to save screenshot: argument of type ‘MaxRetryError’ is not iterable Cannot process image as the screenshot file does not exist at /Users/ynetautomation/Desktop/ynet code azure/YnetAutomatzia/target/screenshots/2024-05-28_23-57-15_TestHomePageJson.test_compare_componentes_at_home_page_to_json[105-components_to_run105].png Failed to query app state: argument of type ‘ProtocolError’ is not iterable FFailed to save screenshot: argument of type ‘MaxRetryError’ is not iterable Cannot process image as the screenshot file does not exist at /Users/ynetautomation/Desktop/ynet code azure/YnetAutomatzia/target/screenshots/2024-05-29_00-57-20_TestHomePageJson.test_compare_componentes_at_home_page_to_json[106-components_to_run106].png Failed to query app state: argument of type ‘ProtocolError’ is not iterable FFailed to save screenshot: argument of type ‘MaxRetryError’ is not iterable Cannot process image as the screenshot file does not exist at /Users/ynetautomation/Desktop/ynet code azure/YnetAutomatzia/target/screenshots/2024-05-29_01-57-25_TestHomePageJson.test_compare_componentes_at_home_page_to_json[107-components_to_run107].png Failed to query app state: argument of type ‘ProtocolError’ is not iterable FFailed to save screenshot: argument of type ‘MaxRetryError’ is not iterable Cannot process image as the screenshot file does not exist at /Users/ynetautomation/Desktop/ynet code azure/YnetAutomatzia/target/screenshots/2024-05-29_02-57-30_TestHomePageJson.test_compare_componentes_at_home_page_to_json[108-components_to_run108].png Failed to query app state: argument of type ‘ProtocolError’ is not iterable FFailed to save screenshot: argument of type ‘MaxRetryError’ is not iterable Cannot process image as the screenshot file does not exist at /Users/ynetautomation/Desktop/ynet code azure/YnetAutomatzia/target/screenshots/2024-05-29_03-57-35_TestHomePageJson.test_compare_componentes_at_home_page_to_json[109-components_to_run109].png Failed to query app state: argument of type ‘ProtocolError’ is not iterable FFailed to save screenshot: argument of type ‘MaxRetryError’ is not iterable Cannot process image as the screenshot file does not exist at /Users/ynetautomation/Desktop/ynet code azure/YnetAutomatzia/target/screenshots/2024-05-29_04-57-40_TestHomePageJson.test_compare_componentes_at_home_page_to_json[110-components_to_run110].png Failed to query app state: argument of type ‘ProtocolError’ is not iterable FFailed to save screenshot: argument of type ‘MaxRetryError’ is not iterable Cannot process image as the screenshot file does not exist at /Users/ynetautomation/Desktop/ynet code azure/YnetAutomatzia/target/screenshots/2024-05-29_05-57-45_TestHomePageJson.test_compare_componentes_at_home_page_to_json[111-components_to_run111].png Failed to query app state: argument of type ‘ProtocolError’ is not iterable FFailed to save screenshot: argument of type ‘MaxRetryError’ is not iterable Cannot process image as the screenshot file does not exist at /Users/ynetautomation/Desktop/ynet code azure/YnetAutomatzia/target/screenshots/2024-05-29_06-57-50_TestHomePageJson.test_compare_componentes_at_home_page_to_json[112-components_to_run112].png Failed to query app state: argument of type ‘ProtocolError’ is not iterable F

Why you using gui server for running tests?

Hey,
I didn’t, i ran appium from the terminal

this is NOT terminal

ok…
but i get the same issue from the terminal