From 68dd34ea7d1fc74872b1f01300e823c6c2b49936 Mon Sep 17 00:00:00 2001 From: DudaGod Date: Thu, 13 Jul 2023 11:39:27 +0300 Subject: [PATCH 1/2] fix: correctly parse sessionId for chrome less 75 --- selenoid.go | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/selenoid.go b/selenoid.go index 1f9a2ee2..1987d387 100644 --- a/selenoid.go +++ b/selenoid.go @@ -413,12 +413,19 @@ func processBody(input []byte, host string) ([]byte, string, error) { if err != nil { return nil, sessionId, fmt.Errorf("parse body response: %v", err) } - if raw, ok := body["value"]; ok { - if v, ok := raw.(map[string]interface{}); ok { - if raw, ok := v["capabilities"]; ok { - if c, ok := raw.(map[string]interface{}); ok { - sessionId = v["sessionId"].(string) - c["se:cdp"] = fmt.Sprintf("ws://%s/devtools/%s/", host, sessionId) + // handle jsonwp response from older browsers (chrome < 75) + if rawId, ok := body["sessionId"]; ok { + if si, ok := rawId.(string); ok { + sessionId = si + } + } else { + if raw, ok := body["value"]; ok { + if v, ok := raw.(map[string]interface{}); ok { + if raw, ok := v["capabilities"]; ok { + if c, ok := raw.(map[string]interface{}); ok { + sessionId = v["sessionId"].(string) + c["se:cdp"] = fmt.Sprintf("ws://%s/devtools/%s/", host, sessionId) + } } } } From e18077a6150938943958a6ff28a8497a457fbcdf Mon Sep 17 00:00:00 2001 From: DudaGod Date: Thu, 13 Jul 2023 12:18:56 +0300 Subject: [PATCH 2/2] test: up go to 1.20.6 to fix vulnerabilities --- .github/workflows/build.yml | 2 +- .github/workflows/release.yml | 2 +- .github/workflows/test.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 17b72f44..82efff99 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,7 +14,7 @@ jobs: - name: Setup Golang uses: actions/setup-go@v3 with: - go-version: ~1.20.4 + go-version: ~1.20.6 - uses: actions/cache@v3 with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 29a7f01a..9ed19d38 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,7 +13,7 @@ jobs: - name: Setup Golang uses: actions/setup-go@v3 with: - go-version: ~1.20.4 + go-version: ~1.20.6 - uses: actions/cache@v3 with: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 545ad8d1..073b4510 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,7 +12,7 @@ jobs: - name: Setup Golang uses: actions/setup-go@v3 with: - go-version: ~1.20.4 + go-version: ~1.20.6 - uses: actions/cache@v3 with: