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

Bug: Two extra spaces in capability "systemPort ," makes it bug prone when trying to fetch value for this key. I was fetching this value for "systemPort" without spaces and got null. With space, got right result.

Đang mở
#1,532 0 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
25/100
Loại issue
Lỗi
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Đình trệ
Công nghệ
java
Lĩnh vực
mobile-dev

Hướng nghiên cứu

Bắt đầu bằng cách tái hiện hành vi trong phương thức freeDevice được nêu, so sánh AppiumDriver.getCapabilities().getCapability("systemPort") với phiên bản có chứa khoảng trắng ở cuối. Theo dõi cách tên capability được trả về và tra cứu; hoàn thành khi khóa không có khoảng trắng lấy được cổng hệ thống và tên capability được báo cáo không còn chứa khoảng trắng ở cuối.

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

Mô tả

The problem

Appium capability "systemPort " has extra spaces in the end. I was trying to fetch this capability based on the key "systemPort " without spaces and was getting null. On careful analysis I saw there were extra spaces after text "systemPort " and with adding those, I could fetch system port.

Below is an example.
[INFO] 2021-10-17 13:26:27,260 AvailableDevices: all available capability names: [app, appPackage, appWaitActivity, automationName, avd, avdArgs, avdLaunchTimeout, avdReadyTimeout, databaseEnabled, desired, deviceApiLevel, deviceManufacturer, deviceModel, deviceName, deviceScreenDensity, deviceScreenSize, deviceUDID, javascriptEnabled, locationContextEnabled, networkConnectionEnabled, pixelRatio, platform, platformName, platformVersion, statBarHeight, systemPort , takesScreenshot, udid, viewportRect, warnings, webStorageEnabled]

Details

While trying to fetch systemPort with extra spaces. results in correct value (see below).
public static void freeDevice(AppiumDriver driver){ Capabilities capabilities = driver.getCapabilities(); log.info("capabilities: {}", capabilities); log.info("avd: {}", capabilities.getCapability("avd")); log.info("udid: {}", capabilities.getCapability("udid")); log.info("systemPort: {}", capabilities.getCapability("systemPort ")); log.info("all available capability names: {}", capabilities.getCapabilityNames()); }

[INFO] 2021-10-17 13:26:27,259 AvailableDevices: avd: Pixel_3_API_31 [INFO] 2021-10-17 13:26:27,259 AvailableDevices: udid: emulator-5554 [INFO] 2021-10-17 13:26:27,259 AvailableDevices: systemPort: 8200 [INFO] 2021-10-17 13:26:27,260 AvailableDevices: all available capability names: [app, appPackage, appWaitActivity, automationName, avd, avdArgs, avdLaunchTimeout, avdReadyTimeout, databaseEnabled, desired, deviceApiLevel, deviceManufacturer, deviceModel, deviceName, deviceScreenDensity, deviceScreenSize, deviceUDID, javascriptEnabled, locationContextEnabled, networkConnectionEnabled, pixelRatio, platform, platformName, platformVersion, statBarHeight, systemPort , takesScreenshot, udid, viewportRect, warnings, webStorageEnabled]

Without these extra spaces in the field "systemPort ", the systemPort is returned as null

Code To Reproduce Issue [ Good To Have ]

Use below method and you can see that when you dont give extra spaces in systemPort, you will get null as returned value.

 public static void freeDevice(AppiumDriver driver){
        Capabilities capabilities = driver.getCapabilities();
        log.info("capabilities: {}", capabilities);
        log.info("avd: {}", capabilities.getCapability("avd"));
        log.info("udid: {}", capabilities.getCapability("udid"));
        log.info("systemPort: {}", capabilities.getCapability("systemPort"));
        log.info("all available capability names: {}", capabilities.getCapabilityNames());
    }
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.