diff --git a/selenoid.go b/selenoid.go index 96e50843..439e2244 100644 --- a/selenoid.go +++ b/selenoid.go @@ -9,7 +9,6 @@ import ( "encoding/json" "errors" "fmt" - "github.com/aerokube/selenoid/info" "io" "log" "net" @@ -24,6 +23,8 @@ import ( "sync" "time" + "github.com/aerokube/selenoid/info" + "github.com/aerokube/selenoid/event" "github.com/aerokube/selenoid/jsonerror" "github.com/aerokube/selenoid/service" @@ -427,6 +428,11 @@ func processBody(input []byte, host string) ([]byte, string, error) { if c, ok := raw.(map[string]interface{}); ok { sessionId = v["sessionId"].(string) c["se:cdp"] = fmt.Sprintf("ws://%s/devtools/%s/", host, sessionId) + if rbv, ok := c["browserVersion"]; ok { + if bv, ok := rbv.(string); ok { + c["se:cdpVersion"] = bv + } + } } } } diff --git a/selenoid_test.go b/selenoid_test.go index ee09ece2..b6f568d0 100644 --- a/selenoid_test.go +++ b/selenoid_test.go @@ -931,7 +931,7 @@ func TestAddedSeCdpCapability(t *testing.T) { fn := func(input map[string]interface{}) { input["value"] = map[string]interface{}{ "sessionId": input["sessionId"], - "capabilities": make(map[string]interface{}), + "capabilities": map[string]interface{}{"browserVersion": "some-version"}, } delete(input, "sessionId") } @@ -958,6 +958,11 @@ func TestAddedSeCdpCapability(t *testing.T) { assert.True(t, ok) capabilities, ok := rc.(map[string]interface{}) assert.True(t, ok) + rcv, ok := capabilities["se:cdpVersion"] + assert.True(t, ok) + cv, ok := rcv.(string) + assert.True(t, ok) + assert.NotEmpty(t, cv) rws, ok := capabilities["se:cdp"] assert.True(t, ok) ws, ok := rws.(string)