selenium icon indicating copy to clipboard operation
selenium copied to clipboard

[🐛 Bug]: Sessions page is white (TypeError: e is undefined) when browserName is custom value

Open mythsunwind opened this issue 2 years ago • 2 comments

What happened?

If a custom value for browserName is used the sessions overview of the grid causes a javascript error and shows a white page.

(We use a custom value for the browserName to specify a specific phone on app tests)

How can we reproduce the issue?

relay.toml

[server]
port = 5555

[node]
detect-drivers = false

[relay]
url = "http://localhost:4723"
status-endpoint = "/status"
configs = [
  "1", "{\"browserName\": \"Google-sargo-Pixel 3a-9BMAY1KFA3\", \"platformName\": \"android\", \"version\": \"11\"}"
]

Steps:

1. Start appium on port 4723
2. Wait a bit for the server to come up
3. Run hub: `java -jar selenium-server-4.3.0.jar hub`
4. Run node: `java -jar selenium-server-4.3.0.jar node --config relay.toml`
5. Create session with curl: `curl -H "Content-Type:application/json; charset=utf-8" -X POST http://127.0.0.1:4444/wd/hub/session -d '{"capabilities":{"alwaysMatch":{"platformName":"android","appium:automationName":"uautomator2"}}}'`
6. Open http://localhost:4444/ui#/sessions in a browser quickly
7. Reload until the session is shown

Relevant log output

TypeError: e is undefined
    xf browser-logo.tsx:12
    Sf BrowserLogo.tsx:29
    React 7
    k scheduler.production.min.js:13
    R scheduler.production.min.js:14
    8886 scheduler.production.min.js:14
    Webpack 12

Operating System

macOS

Selenium version

4.3.0

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

Firefox, Chrome

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

uiautomator2

Are you using Selenium Grid?

4.3.0

mythsunwind avatar Jul 27 '22 09:07 mythsunwind

@mythsunwind, 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!

github-actions[bot] avatar Jul 27 '22 09:07 github-actions[bot]

@mythsunwind, could you please share the contents of the /status endpoint after the session is created? Also the Hub logs please.

diemol avatar Aug 03 '22 21:08 diemol

Content of http://localhost:4444/status from curl:

{
  "value": {
    "ready": false,
    "message": "Selenium Grid not ready.",
    "nodes": [
      {
        "id": "5ff9b637-2976-4e89-b73a-777af2a73df3",
        "uri": "http:\u002f\u002f192.168.121.96:5555",
        "maxSessions": 1,
        "osInfo": {
          "arch": "x86_64",
          "name": "Mac OS X",
          "version": "12.6"
        },
        "heartbeatPeriod": 60000,
        "availability": "UP",
        "version": "4.3.0 (revision a4995e2c09*)",
        "slots": [
          {
            "id": {
              "hostId": "5ff9b637-2976-4e89-b73a-777af2a73df3",
              "id": "2e604869-2bdb-4229-950b-3e6c5fa4f4cf"
            },
            "lastStarted": "2022-10-04T13:44:30.054861Z",
            "session": {
              "capabilities": {
                "appium:automationName": "uiautomator2",
                "automationName": "uiautomator2",
                "databaseEnabled": false,
                "desired": {
                  "platformName": "android",
                  "automationName": "uiautomator2"
                },
                "deviceApiLevel": 28,
                "deviceManufacturer": "Google",
                "deviceModel": "Android SDK built for x86_64",
                "deviceName": "emulator-5554",
                "deviceScreenDensity": 420,
                "deviceScreenSize": "1080x1920",
                "deviceUDID": "emulator-5554",
                "javascriptEnabled": true,
                "locationContextEnabled": false,
                "networkConnectionEnabled": true,
                "pixelRatio": 2.625,
                "platform": "LINUX",
                "platformName": "ANDROID",
                "platformVersion": "9",
                "statBarHeight": 63,
                "takesScreenshot": true,
                "viewportRect": {
                  "left": 0,
                  "top": 63,
                  "width": 1080,
                  "height": 1731
                },
                "warnings": {
                },
                "webStorageEnabled": false
              },
              "sessionId": "933bced4-ffa5-4398-8c23-dbcb45486e8d",
              "start": "2022-10-04T13:44:30.054861Z",
              "stereotype": {
                "browserName": "Google-sargo-Pixel 3a-9BMAY1KFA3",
                "platformName": "ANDROID",
                "version": "11"
              },
              "uri": "http:\u002f\u002flocalhost:4723"
            },
            "stereotype": {
              "browserName": "Google-sargo-Pixel 3a-9BMAY1KFA3",
              "platformName": "ANDROID",
              "version": "11"
            }
          }
        ]
      }
    ]
  }
}

Log of hub: selenium-hub.log Log of node: selenium-node.log

mythsunwind avatar Oct 04 '22 13:10 mythsunwind

I retested it with selenium-server 4.4.0 and 4.5.0 and the issue still happens. The issue comes somewhere from BrowserLogo.tsx which seems to not work with custom values. The console log stack trace leads to https://github.com/SeleniumHQ/selenium/blob/trunk/javascript/grid-ui/src/components/common/BrowserLogo.tsx#L29 and https://github.com/SeleniumHQ/selenium/blob/trunk/javascript/grid-ui/src/util/browser-logo.tsx#L12

mythsunwind avatar Oct 04 '22 13:10 mythsunwind

Thank you for the info, the issue happens because the session has no browserName. I added a check for that and it should not happen anymore. It will be part of 4.5.1, which should be released in the next couple of days.

diemol avatar Oct 18 '22 12:10 diemol

Thank you, Diego. It is always a pleasure to work with you :wink:

mythsunwind avatar Oct 18 '22 12:10 mythsunwind

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[bot] avatar Nov 18 '22 00:11 github-actions[bot]