Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[🐛 Bug]: Selenium grid working for capability "appium:browserName": 'Chrome' and not "browserName": 'Chrome', #12640

Closed
krishtoautomate opened this issue Aug 30, 2023 · 21 comments
Labels
I-question Applied to questions. Issues should be closed and send the user to community resources.

Comments

@krishtoautomate
Copy link

What happened?

used below capabilities to run tests on device browser and tests are going to Queue

{

"browserName": "Chrome",
"platformName": "ANDROID",
"appium:automationName": "UIAutomator2"
}

with below capabilities, tests are running on device browser without issue.

{
"appium:browserName": "Chrome",
"platformName": "ANDROID",
"appium:automationName": "UIAutomator2"
}

attached relay details:

ANDROID-06a49bf4.txt
ANDROID-06a49bf4.yml.txt
ANDROID-06a49bf4.txt
ANDROID-06a49bf4.yml.txt

How can we reproduce the issue?

attached relay details above.

relayed device as appium node to selenium grid.


use below capabilites to run tests to reproduce issue, tests are waiting in queue till timeout:

{

  "browserName": "Chrome",
  "platformName": "ANDROID",
  "appium:automationName": "UIAutomator2"
}

Relevant log output

tests are waiting in queue till timeout when used below capabilities:

{

  "browserName": "Chrome",
  "platformName": "ANDROID",
  "appium:automationName": "UIAutomator2"
}

Operating System

macOS Ventura

Selenium version

Java JDK 11

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

Chrome

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

ChromeDriver 116

Are you using Selenium Grid?

4.11

@diemol
Copy link
Member

diemol commented Aug 30, 2023

        [server]
        host = "172.21.34.232"
        url = "http://172.21.34.232:5552"
        port = 5552
        # session-request-timeout = 1800

        [events]
        publish = "tcp://172.21.34.239:4442"
        subscribe = "tcp://172.21.34.239:4443"

        [node]
        # url = 172.21.34.232
        detect-drivers = false
        max-sessions = 1
        session-timeout = 180

        [relay]
        url = "http://172.21.34.232:4782"
        service-host = "172.21.34.232"
        service-port = 4782
        status-endpoint = "/status"

        configs = [
            "1", "{\"platformName\": \"ANDROID\", \"appium:udid\": \"06a49bf4\", \"appium:deviceName\": \"06a49bf4\",\"appium:automationName\": \"UIAutomator2\", \"appium:systemPort\":8301, \"appium:platformVersion\": \"13\", \"appium:deviceClass\":\"NA\"}"
        ]
        [server]
        host = "172.21.34.232"
        url = "http://172.21.34.232:5552"
        port = 5552
        # session-request-timeout = 1800

        [events]
        publish = "tcp://172.21.34.239:4442"
        subscribe = "tcp://172.21.34.239:4443"

        [node]
        # url = 172.21.34.232
        detect-drivers = false
        max-sessions = 1
        session-timeout = 180

        [relay]
        url = "http://172.21.34.232:4782"
        service-host = "172.21.34.232"
        service-port = 4782
        status-endpoint = "/status"

        configs = [
            "1", "{\"platformName\": \"ANDROID\", \"appium:udid\": \"06a49bf4\", \"appium:deviceName\": \"06a49bf4\",\"appium:automationName\": \"UIAutomator2\", \"appium:systemPort\":8301, \"appium:platformVersion\": \"13\", \"appium:deviceClass\":\"NA\"}"
        ]

@diemol
Copy link
Member

diemol commented Aug 30, 2023

You need to specify browserName in the configuration if you want to be used in the matching process.

@diemol diemol added I-question Applied to questions. Issues should be closed and send the user to community resources. and removed I-defect needs-triaging labels Aug 30, 2023
@krishtoautomate
Copy link
Author

if I specify browserName, it stop me to run tests on apps as you get an error saying cannot include both browserName and app details

@krishtoautomate
Copy link
Author

i have requirement to run tests on browsers as well as apps so i dont include both in relay config.

but what i dont understand is if i run tests with appium:browserName --it works, if run with browserName capability on test, it doesnt work.

@github-actions
Copy link

@krishtoautomate, thank you for creating this issue. We will troubleshoot it as soon as we can.


Info for maintainers

Triage this issue by using labels.

If information is missing, add a helpful comment and then I-issue-template label.

If the issue is a question, add the I-question label.

If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.

If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C), add the applicable G-* label, and it will provide the correct link and auto-close the issue.

After troubleshooting the issue, please add the R-awaiting answer label.

Thank you!

@diemol
Copy link
Member

diemol commented Aug 30, 2023

You can add two configurations—one for browsers and one for apps.

@github-actions
Copy link

💬 Please ask questions at:

@krishtoautomate
Copy link
Author

You can add two configurations—one for browsers and one for apps.

can you provide sample config

@diemol
Copy link
Member

diemol commented Aug 30, 2023

You can stack them up in the config

configs = [
  "1", "{\"browserName\": \"chrome\", \"platformName\": \"android\", \"appium:platformVersion\": \"11\"}",
  "1", "{\"browserName\": \"safari\", \"platformName\": \"iOS\", \"appium:platformVersion\": \"15\"}"
]

@krishtoautomate
Copy link
Author

working with above suggested solution.

but still didnt understand why not working for browserName.

@krishtoautomate
Copy link
Author

@diemol

used below configuration for Android and facing error as : cannot use appPackage and browserName.

    configs = [
        "1", "{\"platformName\": \"ANDROID\", \"appium:udid\": \"1C041FDEE000RU\", \"appium:deviceName\": \"Pixel 6 Pro\",\"appium:automationName\": \"UIAutomator2\", \"appium:systemPort\":8302, \"appium:platformVersion\": \"12\", \"appium:deviceClass\":\"NA\"}",
        "1", "{\"platformName\": \"ANDROID\", \"appium:udid\": \"1C041FDEE000RU\", \"appium:deviceName\": \"Pixel 6 Pro\",\"appium:automationName\": \"UIAutomator2\", \"browserName\": \"Chrome\", \"appium:systemPort\":8302, \"appium:platformVersion\": \"12\", \"appium:deviceClass\":\"NA\"}"
    ]

looks like this needed fix

@krishtoautomate
Copy link
Author

image

only browser test is working and not apps for the above configuration

@krishtoautomate
Copy link
Author

Original error: The desired should not include both of an 'appPackage' and a 'browserName' Host info: host: 'B01SO422', ip: 'fe80:0:0:0:6d:209:e46e:ce0a%en0' Build info: version: '4.11.0', revision: '040bc5406b' System info: os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '11.5', java.version: '11.0.12' Driver info: driver.version: unknown Build info: version: '4.11.0', revision: '040bc5406b' System info: os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '11.5', java.version: '11.0.12' Driver info: driver.version: unknown Build info: version: '4.11.0', revision: '040bc5406b' System info: os.name: 'Linux', os.arch: 'amd64', os.version: '5.15.49-linuxkit-pr', java.version: '11.0.20' Driver info: driver.version: unknown

@krishtoautomate
Copy link
Author

This is defect which need to be investigated why selenium hub is struck in queue.

May be if platformName = ANDROID, browser manager should ignore download of drivers.

@diemol
Copy link
Member

diemol commented Sep 4, 2023

@diemol

used below configuration for Android and facing error as : cannot use appPackage and browserName.

    configs = [
        "1", "{\"platformName\": \"ANDROID\", \"appium:udid\": \"1C041FDEE000RU\", \"appium:deviceName\": \"Pixel 6 Pro\",\"appium:automationName\": \"UIAutomator2\", \"appium:systemPort\":8302, \"appium:platformVersion\": \"12\", \"appium:deviceClass\":\"NA\"}",
        "1", "{\"platformName\": \"ANDROID\", \"appium:udid\": \"1C041FDEE000RU\", \"appium:deviceName\": \"Pixel 6 Pro\",\"appium:automationName\": \"UIAutomator2\", \"browserName\": \"Chrome\", \"appium:systemPort\":8302, \"appium:platformVersion\": \"12\", \"appium:deviceClass\":\"NA\"}"
    ]

looks like this needed fix

This error comes directly from Appium.

@diemol
Copy link
Member

diemol commented Sep 4, 2023

This is about proper configuration and sending the appropriate capabilities.

I have shared the links above where you can join our chat and ask questions, I will be there and we can continue. This is not a forum but rather an issue tracker.

@krishtoautomate
Copy link
Author

Appium

Yes this came from appium but the below one going to queue when trying to send browserName = Chrome is from selenium

configs = [
"1", "{"platformName": "ANDROID", "appium:udid": "06a49bf4", "appium:deviceName": "06a49bf4","appium:automationName": "UIAutomator2", "appium:systemPort":8301, "appium:platformVersion": "13", "appium:deviceClass":"NA"}"
]

@krishtoautomate
Copy link
Author

@diemol

used below configuration for Android and facing error as : cannot use appPackage and browserName.

configs = [
    "1", "{\"platformName\": \"ANDROID\", \"appium:udid\": \"1C041FDEE000RU\", \"appium:deviceName\": \"Pixel 6 Pro\",\"appium:automationName\": \"UIAutomator2\", \"appium:systemPort\":8302, \"appium:platformVersion\": \"12\", \"appium:deviceClass\":\"NA\"}",
    "1", "{\"platformName\": \"ANDROID\", \"appium:udid\": \"1C041FDEE000RU\", \"appium:deviceName\": \"Pixel 6 Pro\",\"appium:automationName\": \"UIAutomator2\", \"browserName\": \"Chrome\", \"appium:systemPort\":8302, \"appium:platformVersion\": \"12\", \"appium:deviceClass\":\"NA\"}"
]

looks like this needed fix

This error comes directly from Appium.

Agree but below one came from selenium:

configs = [
"1", "{"platformName": "ANDROID", "appium:udid": "06a49bf4", "appium:deviceName": "06a49bf4","appium:automationName": "UIAutomator2", "appium:systemPort":8301, "appium:platformVersion": "13", "appium:deviceClass":"NA"}"
]

broswerName:Chrome is going to Queue

appium:browserName is working fine

@krishtoautomate
Copy link
Author

Looks like their is bug in slot-matcher when browserName capability is parsed. if browserName doesnt exist, it is not matching with any other capabilities. as browserName, browserVersion and platformName are default slot matcher with 'and' condition instead of 'or'.

posted same in discussions*

@krishtoautomate
Copy link
Author

krishtoautomate commented Sep 7, 2023

here is the fix - which is also tested in my local.

boolean browserNameMatch =
        (stereotype.getBrowserName() == null || stereotype.getBrowserName().isEmpty() || capabilities.getBrowserName() == null || capabilities.getBrowserName().isEmpty())
            || Objects.equals(stereotype.getBrowserName(), capabilities.getBrowserName());
    boolean browserVersionMatch =
        (stereotype.getBrowserVersion() == null || stereotype.getBrowserVersion().isEmpty() || capabilities.getBrowserVersion() == null || capabilities.getBrowserVersion().isEmpty())
            || Objects.equals(stereotype.getBrowserVersion(), capabilities.getBrowserVersion());

Copy link

github-actions bot commented Dec 6, 2023

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked and limited conversation to collaborators Dec 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
I-question Applied to questions. Issues should be closed and send the user to community resources.
Projects
None yet
Development

No branches or pull requests

2 participants