Appium Java client 8.3.0. @iOSXCUITFindBy uses CSS selector irrespective of the locator used for the element
维护者通常 5 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 42/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- java
- 领域
- mobile-dev, testing
调研方向
首先跟踪 @iOSXCUITFindBy 和 Page factory 如何将 accessibility 和 id 属性转换为 WebDriver 的 find-element 请求。使用报告中的两个 locator 重现该问题,并比较 Appium 日志。完成标准是每个 locator 都使用其对应的 strategy 和 value 发送,而不是两者都变成 CSS selector。
由索引模型根据 Issue 内容生成。
描述
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.
- 主要语言
- Java
- 星标
- 1.3k
- 派生
- 755
- 平均合并
- 5 天 14 小时
- 30 天内合并 PR
- 8
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
appium/java-client 的其他 Issue
-
难度 5/5 一周以上 新手友好度 25/100
appium/java-client#2426 ·
维护者通常 5 天内回复
-
bug
难度 4/5 3-5 天 新手友好度 50/100
appium/java-client#2372 ·
维护者通常 5 天内回复
-
难度 5/5 一周以上 新手友好度 30/100
appium/java-client#2368 ·
维护者通常 5 天内回复
-
难度 2/5 1-3 小时 新手友好度 30/100
appium/java-client#2341 · 1 条评论 ·
维护者通常 5 天内回复
-
难度 5/5 一周以上 新手友好度 15/100
appium/java-client#2323 ·
维护者通常 5 天内回复
查看 appium/java-client 的全部 Issue
相似的 Issue
-
link-check link-check:manual
难度 2/5 1-3 小时 新手友好度 85/100
-
难度 1/5 1 小时以内 新手友好度 91/100
open-telemetry/opentelemetry-java#8870 ·
维护者通常 1 天内回复
-
P2 testing
难度 1/5 1 小时以内 新手友好度 90/100
维护者通常 1 天内回复
-
enhancement javascript
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
area/core kind/bug status/triage team/core-shared
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复