Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

Appium Java client 8.3.0. @iOSXCUITFindBy uses CSS selector irrespective of the locator used for the element

未關閉
#1,885 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 5 天內回覆

還沒有人認領這個 Issue。

評估

難度
4/5
預估耗時
3-5 天
新手友好度
42/100
Issue 類型
缺陷
描述清晰度
基本清楚
活躍度
停滯
技術堆疊
java

研究方向

先追蹤 @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 範本
  • 沒有貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

appium/java-client 的其他 Issue

查看 appium/java-client 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。