Skip to content

Not able to interact with Web View elements using asSecured() #4796

@LoukasKonstantinou

Description

@LoukasKonstantinou

Did you test using the latest Detox?

  • I have tested this issue on the latest Detox release and it still reproduces.

Did your test fail and you're not sure why?

  • I have read the troubleshooting guide and it didn't help me.

What happened?

Our native app uses a webview as a login page. We implemented our test steps using asSecured() to interact with the elements and while it did work fine in the beginning, it seems that now Detox is hanging while waiting for the elements "to exist".

The elements themselves haven't changed at all, we're using the by.label matcher and the labels are 100% the same.

The page is definitely a webview and not an in-app browser like issue 4791.

Removing asSecured() from the steps allows Detox to see the elements, but when it tries to typeText into the fields, it types nothing.

What was the expected behaviour?

No response

Help us reproduce this issue!

No response

In what environment did this happen?

Detox version: 20.33.0
React Native version: 0.71.14
Has Fabric (React Native's new rendering system) enabled: (yes/no) no
Node version: 20.11.1
Device model: iPhone 16 Plus
iOS version: 18.1
macOS version: 14.7.6
Xcode version: 16.1
Test-runner (select one): jest

Detox logs

Detox logs
   ● Login › should be able to login

    DetoxRuntimeError: XCUITest runner failed with no error message. Runner stdout: Command line invocation:
        /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -xctestrun /Users/loukas.konstantinou/Library/Detox/ios/xcuitest-runner/243402ef1605e82421a0bc650e695d39f6da42f9/Products/DetoxXCUITestRunner_DetoxXCUITestRunner_iphonesimulator18.1-arm64-x86_64.xctestrun -sdk iphonesimulator -destination "platform=iOS Simulator,id=0EE2A6D8-6A99-4AEB-ABF4-1DBC86A8EE7D" test-without-building

    User defaults from command line:
        IDEPackageSupportUseBuiltinSCM = YES

    Build settings from command line:
        SDKROOT = iphonesimulator18.1

    2025-07-09 17:18:38.796084+0100 DetoxXCUITestRunner-Runner[59999:2702329] [Default] Running tests...
    2025-07-09 17:18:38.807081+0100 DetoxXCUITestRunner-Runner[59999:2702545] [General] Failed to send CA Event for app launch measurements for ca_event_type: 0 event_name: com.apple.app_launch_measurement.FirstFramePresentationMetric
        t =      nans Interface orientation changed to Portrait
    Test Suite 'All tests' started at 2025-07-09 17:18:38.934.
    Test Suite 'DetoxXCUITestRunner.xctest' started at 2025-07-09 17:18:38.935.
    Test Suite 'DetoxXCUITestRunner' started at 2025-07-09 17:18:38.935.
    Test Case '-[DetoxXCUITestRunner.DetoxXCUITestRunner testRunner]' started.
        t =     0.00s Start Test at 2025-07-09 17:18:38.935
        t =     0.02s Set Up
        t =     0.02s Open com.xxx.xxx
        t =     0.02s     Activate com.xxx.xxx
        t =     0.03s         Wait for com.xxx.xxx to idle
        t =     0.07s Waiting 1.0s for "field-email" Any to exist
        t =     1.08s     Checking `Expect predicate `existsNoRetry == 1` for object "field-email" Any`
        t =     1.08s         Checking existence of `"field-email" Any`
        t =     1.34s         Capturing element debug description
        t =     1.34s Checking existence of `"field-email" Any`
        t =     3.46s Checking existence of `"field-email" Any` (retry 1)
        t =     4.55s Checking existence of `"field-email" Any` (retry 2)
    /Users/builder/uibuilder/work/detox/ios/DetoxXCUITestRunner/DetoxXCUITestRunner/Handlers/ActionHandler.swift:13: error: -[DetoxXCUITestRunner.DetoxXCUITestRunner testRunner] : Failed to get matching snapshots: Error kAXErrorIllegalArgument getting snapshot for element <AXUIElementRef 0x600000ed2010> {pid=59947} {uid=[ID:1 hash:0x0]}
        t =     4.65s Tear Down
    Test Case '-[DetoxXCUITestRunner.DetoxXCUITestRunner testRunner]' failed (4.661 seconds).
    Test Suite 'DetoxXCUITestRunner' failed at 2025-07-09 17:18:43.596.
    	 Executed 1 test, with 1 failure (0 unexpected) in 4.661 (4.661) seconds
    Test Suite 'DetoxXCUITestRunner.xctest' failed at 2025-07-09 17:18:43.596.
    	 Executed 1 test, with 1 failure (0 unexpected) in 4.661 (4.661) seconds
    Test Suite 'All tests' failed at 2025-07-09 17:18:43.596.
    	 Executed 1 test, with 1 failure (0 unexpected) in 4.661 (4.662) seconds

    Test session results, code coverage, and logs:
    	/Users/loukas.konstantinou/Library/Developer/Xcode/DerivedData/DetoxXCUITestRunner-aejfgvxbshsquxawieyesytknupp/Logs/Test/Test-DetoxXCUITestRunner-2025.07.09_17-18-36-+0100.xcresult

Device logs

Device logs
paste your device.log here!

More data, please!

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions