Skip to content

bug: Unable to timeout find_elements and webdriver.Remote #855

Closed

Description

@eyJhb

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Sometimes webdriver.Remote will hang, and it will timeout at any point.
The same goes for using find_elements, if WDA crashes/hangs, then it will never timeout.

I've tried setting appium:newCommandTimeout to 5, but it will still just hang forever.
The only thing I've found that worked, was sitting driver.command_executor.keep_alive = False and driver.command_executor.set_timeout(5).

It's quite unclear, what the best/correct way, is to set a timeout for "anything" so that it cannot just hang indefinitely.

Expected Behavior

That it would timeout after 5 seconds, and there would be a clear documented way of doing this.

Minimal Reproducible Example

from appium import webdriver
from appium.webdriver.common.appiumby import AppiumBy

ios_caps = {
    "appium:automationName": "XCUITest",
    "platformName": "iOS",
    "appium:udid": "00008020-001655400E82002E",
    "appium:webDriverAgentUrl": "http://localhost:7777",
    "appium:newCommandTimeout": 5,
}

driver = webdriver.Remote("http://127.0.0.1:4723", ios_caps)
driver.command_executor.set_timeout(5)
driver.find_elements(by=AppiumBy.IOS_PREDICATE, value="type LIKE '**'")

The find_elements in a slow app (ie. TikTok) will never return.

Environment

  • Operating system:
  • If running via appium CLI...
    • Appium CLI version (output of appium --version): 2.0.0-beta.58
    • Node.js version (output of node --version): v18.12.1
    • npm version (output of npm --version): 8.19.2
    • Last appium version which did not exhibit the problem: ?
  • If running Appium Desktop, its version:
  • Appium driver(s) and their version(s): - xcuitest@4.21.1 [installed (npm)]
  • Appium plugin(s) and their version(s): go-ios (gist attached later)
  • Platform and version under test: iOS 16.4.1
  • Real device or emulator/simulator: real device

Link to Appium Logs

No response

Futher Information

No response

Activity

  1. eyJhb commented on Apr 27, 2023

    @eyJhb
    ContributorAuthor

    @mykola-mokhnach is there a way to do this for other clients?

  2. mykola-mokhnach commented on Apr 27, 2023

    @mykola-mokhnach
    Contributor

    I don't know. xcuitest driver has the appium:commandTimeouts capability, which might be helpful in such situation

  3. eyJhb commented on Apr 27, 2023

    @eyJhb
    ContributorAuthor

    Based on the default value of that, it doesn't work. I've had tests hang for hours, and the default value specifies 120s.
    Most of the time, the case is that the WDA server becomes unresponsive, and Appium will just hang forever waiting for a response.

  4. lana-20 commented on Feb 27, 2025

    @lana-20

    @eyJhb

    Suggestions:

    In addition to the 5 required caps, we need 4 new caps to run tests on a real device with Appium: xcodeOrgId, xcodeSigningId, udid, and updatedWDABundleId.
    Ref: https://medium.com/@begunova/automating-real-ios-devices-with-appium-1fa729b58f51#:~:text=Test%20Setup%20for%20Real%20Devices

    A couple of optional caps to try: derivedDataPath, noReset, showXcodeLog.
    Ref: https://appiumpro.com/editions/77-optimizing-webdriveragent-startup-performance

    Example:

    CAPS = {
        "platformName": "iOS",
        "appium:options": {
            "platformVersion": "17.7",
            "deviceName": "iPhone 15 Plus",
            "automationName": "XCUITest",
            "bundleId": "<com.companyname.appid>", # or "app": "path/to/testapp.ipa", eg.: "https://github.com/saucelabs/sample-app-mobile/releases/download/2.7.1/iOS.RealDevice.SauceLabs.Mobile.Sample.app.2.7.1.ipa"
            "udid": "<device_udid>",  # or "auto" for a single device
            "xcodeOrgId": "<org_unit_number>",
            "xcodeSigningId": "iPhone Developer",
            "updatedWDABundleId": "<com.companyname.wda>",
            "showXcodeLog": True, # optional - shows xcodebuild's log details
            "noReset": True, # optional
            "webDriverAgentUrl": "http://localhost:8100",
            "derivedDataPath": "/Users/username/Library/Developer/Xcode/DerivedData/WebDriverAgentpridxpigtzdjdecthgzpygcmdkp"  # optional
        }
    }
    

    If any caps were intentionally omitted from the provided Minimal Reproducible Example for brevity, then please ignore my comment. This is a mere suggestion.

  5. added a commit that references this issue on Sep 5, 2026
    9bfcc07
  6. added a commit that references this issue on Sep 9, 2026
    d47b730
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions