Skip to content

[🐛 Bug]: Cannot start mobile application with appium when slot also specifies a 'browserName' capability #14216

@bhecquet

Description

@bhecquet

What happened?

Hello,

I've set up a selenium grid with an appium server which is linked to grid through relay feature

the android device stereotype is:

{
"stereotype": {
              "appium:deviceName": "sdk_gphone64_x86_64",
              "appium:platformVersion": "14",
              "browserName": "chrome",
              "platformName": "ANDROID",
            }
}

When I want to test a mobile application, I provide the following capabilities

{
    "platformName": "ANDROID",
    "appium:appActivity": "com.company.AuthenticationActivity",
    "appium:chromedriverExecutable": "D:/drivers/chromedriver_113.0_chrome-113-114.exe",
    "appium:fullReset": true,
    "appium:automationName": "UIAutomator2",
    "appium:deviceName": "sdk_gphone64_x86_64",
    "appium:newCommandTimeout": 120,
    "appium:platformVersion": "14",
    "appium:app": "http://127.0.0.1:44454/app_2024_06_27.apk",
    "appium:udid": "emulator-5554"
}

But, the received capabilities on appium side are:

{
    "platformName": "ANDROID",
    "browserName": "chrome",
    "appium:appActivity": "com.company.AuthenticationActivity",
    "appium:chromedriverExecutable": "D:/drivers/chromedriver_113.0_chrome-113-114.exe",
    "appium:fullReset": true,
    "appium:automationName": "UIAutomator2",
    "appium:deviceName": "sdk_gphone64_x86_64",
    "appium:newCommandTimeout": 120,
    "appium:platformVersion": "14",
    "appium:app": "http://127.0.0.1:44454/app_2024_06_27.apk",
    "appium:udid": "emulator-5554"
}

This is due to

capabilities = capabilities.merge(stereotype);

which merges stereotypes from slot (where 'browserName' is present) and requested capabilities (where 'appium:app' is present)
According to UIAutomator2 driver, Do not provide both app and browserName capabilities at once.

This change has been introduced with this commit: 0013140

I think one of the solution would be to make de "merge" operation more precise (e.g: not adding browserName if appium:app is provided). This would add some specific code whereas relay session is generic, but it's a common use case
If you have any other idea, I would be glad to implement a correction

Bertrand

How can we reproduce the issue?

See details above

Relevant log output

Appium logs:

2024-07-01 07:52:05:854 �[38;5;-154m[AndroidUiautomator2Driver@5a4c] Creating session with W3C capabilities: {
  "alwaysMatch": {
    "browserName": "chrome",
    "goog:chromeOptions": {},
    "platformName": "ANDROID",
    "appium:appActivity": "com.company.AuthenticationActivity",
    "appium:chromedriverExecutable": "D:/drivers/chromedriver_113.0_chrome-113-114.exe",
    "appium:fullReset": true,
    "appium:automationName": "UIAutomator2",
    "appium:deviceName": "sdk_gphone64_x86_64",
    "appium:newCommandTimeout": 120,
    "appium:platformVersion": "14",
    "appium:app": "http://10.200.71.24:44454/grid/admin/FileServlet?file=file:upload/app/d40777c0-c046-4dc0-8cc6-f7b419cfd3b6/app_2024_06_27.apk",
    "appium:udid": "emulator-5554"
  },
  "firstMatch": [
    {}
  ]
}
2024-07-01 07:52:05:862 �[38;5;-154m[AndroidUiautomator2Driver@5a4c] The following provided capabilities were not recognized by this driver:
2024-07-01 07:52:05:863 �[38;5;-154m[AndroidUiautomator2Driver@5a4c]   goog:chromeOptions
2024-07-01 07:52:05:864 �[38;5;-154m[AndroidUiautomator2Driver@5a4c] The desired capabilities should generally not include both an 'app' and a 'browserName'

Operating System

Any

Selenium version

4.18.1

What are the browser(s) and version(s) where you see this issue?

Chrome / not related to browser

What are the browser driver(s) and version(s) where you see this issue?

not related to browser

Are you using Selenium Grid?

4.18.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-needs-triagingA Selenium member will evaluate this soon!I-defectSomething is not working as intended

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions