Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đang mở
#1,885 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
42/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
java
Lĩnh vực
mobile-dev, testing

Hướng nghiên cứu

Bắt đầu bằng cách lần theo cách @iOSXCUITFindBy và Page factory chuyển các thuộc tính accessibility và id thành yêu cầu find-element của WebDriver. Tái hiện vấn đề với hai locator trong báo cáo và so sánh các log của Appium. Được xem là hoàn thành khi mỗi locator được gửi cùng strategy và value tương ứng, thay vì cả hai đều trở thành một CSS selector.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
Java
Star
1.3k
Fork
755
Merge trung bình
5 ngày 14 giờ
Pull request đã merge (30 ngày)
8

Chuẩn bị môi trường

  • Không có Dockerfile hay tệp Docker Compose
  • Có mẫu pull request
  • Không có hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của appium/java-client

Tất cả issue của appium/java-client

Issue tương tự

Thêm issue về Java

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.