appium / java-client

Java language binding for writing Appium Tests, conforms to W3C WebDriver Protocol
Apache License 2.0
1.21k stars 756 forks source link

Unable to find Element in PageFactory #2169

Closed Phoenix124 closed 4 months ago

Phoenix124 commented 4 months ago

Description

I try to use both annotations on element

    @AndroidFindBy(uiAutomator = "resourceIdMatches(\".*:id/login_container\")")
    @iOSXCUITBy(iOSNsPredicate = "name == 'RootViewController'")
    private WebElement rootPage;

Environment

Details

PageFactory initialization

PageFactory.initElements(new AppiumFieldDecorator(driver), this);

Logs

[XCUITestDriver@dcd5 (2ec2756f)] Proxying [POST /element] to [POST http://127.0.0.1:8204/session/9B78AD19-45EF-48A7-8FFD-084DA3B057A2/element] with body: {"using":"id","value":"rootPage"}
[XCUITestDriver@dcd5 (2ec2756f)] Got response with status 404: {"value":{"error":"no such element","message":"unable to find an element using 'id', value 'rootPage'","traceback":"(\n\t0   WebDriverAgentLib                   0x0000000100adff58 FBNoSuchElementErrorResponseForRequest + 252\n\t1   WebDriverAgentLib                   0x0000000100adfd88 +[FBFindElementCommands handleFindElement:] + 312\n\t2   WebDriverAgentLib                   0x0000000100aa3cfc -[FBRoute_TargetAction mountRequest:intoResponse:] + 168\n\t3   WebDriverAgentLib                   0x0000000100a8da08 __37-[FBWebServer registerRouteHandlers:]_block_invoke + 404\n\t4   WebDriverAgentLib                   0x0000000100ac5c3c -[RoutingHTTPServer handleRoute:withRequest:response:] + 168\n\t5   WebDriverAgentLib                   0x0000000100ac672c __72-[RoutingHTTPServer routeMethod:withPath:parameters:request:connection:]_block_invoke + 64\n\t6   libdispatch.dylib                   0x0000000180171978 _dispatch_client_callout + 16\n\t7   libdispatch.dylib                   0x00000001801816f0 _dispatc...
[W3C] Matched W3C error code 'no such element' to NoSuchElementError