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.
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.3k
- Forks
- 752
- Avg merge
- 6d 21h
- Merged PRs (30d)
- 8
Description
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());
}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the behavior in the shown freeDevice method, comparing AppiumDriver.getCapabilities().getCapability("systemPort") with the version containing trailing spaces. Trace how capability names are returned and looked up; done means the unspaced key retrieves the system port and the reported capability name no longer contains trailing spaces.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- mobile-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100