java-client
java-client copied to clipboard
Appium Java client 8.3.0. @iOSXCUITFindBy uses CSS selector irrespective of the locator used for the element
Description
@iOSXCUITFindBy uses CSS selector irrespective of the locator used for the element identifications.
Environment
- Java client build version or git revision if you use some snapshot:8.3.0
- Appium server version or git revision if you use some snapshot: V2
- Desktop OS/version used to run Appium if necessary: Ventura 13.2.1
- Node.js version (unless using Appium.app|exe) or Appium CLI or Appium.app|exe: 18.15
- Mobile platform/version under test: 16.3.1
- Real device or emulator/simulator: Real Device
Details
My Page factory Web elements,
@iOSXCUITFindBy(accessibility = "Allow")
public WebElement btnAllow;
@iOSXCUITFindBy(id = "Allow")
public WebElement btnAllow;
Appium Server log for both the locators are same as below in Appium Logs:
[HTTP] {"using":"css selector","value":"#btnAllow"}
Code To Reproduce Issue [ Good To Have ]
My XCUITestOptions are as below
options.setDeviceName("Device Name"); options.setApp("AppPath/MyWork.app"); options.setPlatformVersion("16.3.1"); options.setPlatformName("iOS"); options.setBundleId("com.xx.xxx.mywork"); options.setUdid("xxxxxxxxx-***"); options.setWdaLaunchTimeout(Duration.ofSeconds(20));
Exception Stacktraces
Please create a gist with the pasted stacktrace of the exception thrown by java.
Link To Appium Logs
[AppiumDriver@3d7e] New XCUITestDriver session created successfully, session 1ff5105f-f613-4fd1-808c-67453526c3db added to master session list
[debug] [XCUITestDriver@576d (1ff5105f)] Cached the protocol value 'W3C' for the new session 1ff5105f-f613-4fd1-808c-67453526c3db
[debug] [XCUITestDriver@576d (1ff5105f)] Responding to client with driver.createSession() result: {"capabilities":{"webStorageEnabled":false,"locationContextEnabled":false,"browserName":"","platform":"MAC","javascriptEnabled":true,"databaseEnabled":false,"takesScreenshot":true,"networkConnectionEnabled":false,"platformName":"ios","app":"/xxxxxxxxxxx//MyWork.app","automationName":"XCuiTest","bundleId":"com.xxxxxxxx.mywork","deviceName":"xxxxxxx","platformVersion":"16.3.1","udid":"xxxxxxxxx","wdaLaunchTimeout":20000}}
[HTTP] <-- POST /session 200 25238 ms - 664
[HTTP]
[HTTP] --> POST /session/1ff5105f-f613-4fd1-808c-67453526c3db/timeouts
[HTTP] {"implicit":80000}
[debug] [XCUITestDriver@576d (1ff5105f)] Calling AppiumDriver.timeouts() with args: [null,null,null,null,80000,"1ff5105f-f613-4fd1-808c-67453526c3db"]
[debug] [XCUITestDriver@576d (1ff5105f)] Executing command 'timeouts'
[debug] [XCUITestDriver@576d (1ff5105f)] W3C timeout argument: {"implicit":80000}}
[debug] [XCUITestDriver@576d (1ff5105f)] Set implicit wait to 80000ms
[debug] [XCUITestDriver@576d (1ff5105f)] Responding to client with driver.timeouts() result: null
[HTTP] <-- POST /session/1ff5105f-f613-4fd1-808c-67453526c3db/timeouts 200 4 ms - 14
[HTTP]
[HTTP] --> POST /session/1ff5105f-f613-4fd1-808c-67453526c3db/element
[HTTP] {"using":"css selector","value":"#btnAllow"}
[debug] [XCUITestDriver@576d (1ff5105f)] Calling AppiumDriver.findElement() with args: ["css selector","#btnAllow","1ff5105f-f613-4fd1-808c-67453526c3db"]
[debug] [XCUITestDriver@576d (1ff5105f)] Executing command 'findElement'
[debug] [XCUITestDriver@576d (1ff5105f)] Valid locator strategies for this request: xpath, id, name, class name, -ios predicate string, -ios class chain, accessibility id, css selector
[debug] [XCUITestDriver@576d (1ff5105f)] Waiting up to 80000 ms for condition
[debug] [XCUITestDriver@576d (1ff5105f)] Matched '/element' to command name 'findElement'
[debug] [XCUITestDriver@576d (1ff5105f)] Proxying [POST /element] to [POST http://127.0.0.1:8100/session/F4A03C6E-3D98-4992-82E3-0FC164E4B6A6/element] with body: {"using":"class chain","value":"/*[name == \"btnAllow\"]"}
[XCUITestDriver@576d (1ff5105f)] Got response with status 404: {"value":{"error":"no such element","message":"unable to find an element using 'class chain', value '/*[name == \"btnAllow\"]'","traceback":"(\n\t0 WebDriverAgentLib 0x00000001056056ec FBNoSuchElementErrorResponseForRequest + 252\n\t1 WebDriverAgentLib 0x000000010560551c +[FBFindElementCommands handleFindElement:] + 312\n\t2 WebDriverAgentLib 0x00000001055ca5a4 -[FBRoute_TargetAction mountRequest:intoResponse:] + 168\n\t3 WebDriverAgentLib 0x00000001055b65b4 __37-[FBWebServer registerRouteHandlers:]_block_invoke + 404\n\t4 WebDriverAgentLib 0x00000001055ec280 -[RoutingHTTPServer handleRoute:withRequest:response:] + 168\n\t5 WebDriverAgentLib 0x00000001055ecd70 __72-[RoutingHTTPServer routeMethod:withPath:parameters:request:connection:]_block_invoke + 64\n\t6 libdispatch.dylib 0x000000018fbd0f88 DED4D0A5-1420-32AE-83A6-C31D938A1C9A + 16264\n\t7 libdispatch.dylib ...
[debug] [W3C] Matched W3C error code 'no such element' to NoSuchElementError
[debug] [XCUITestDriver@576d (1ff5105f)] Waited for 55 ms so far.
This is probably happening because the page factory was not initialized properly