MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / createSessionData

Function createSessionData

javascript/grid-ui/src/models/session-data.ts:57–100  ·  view source on GitHub ↗
(
  id: string,
  capabilities: string,
  startTime: string,
  uri: string,
  nodeId: string,
  nodeUri: string,
  sessionDurationMillis: number,
  slot: any,
  origin: string
)

Source from the content-addressed store, hash-verified

55}
56
57export function createSessionData (
58 id: string,
59 capabilities: string,
60 startTime: string,
61 uri: string,
62 nodeId: string,
63 nodeUri: string,
64 sessionDurationMillis: number,
65 slot: any,
66 origin: string
67): SessionData {
68 const parsed = JSON.parse(capabilities) as Capabilities
69 const browserName = parsed.browserName
70 const browserVersion = parsed.browserVersion ?? parsed.version
71 const platformName = parsed.platformName ?? parsed.platform
72 let vnc: string = parsed['se:vnc'] ?? ''
73 if (vnc.length > 0) {
74 try {
75 const url = new URL(origin)
76 const vncUrl = new URL(vnc)
77 url.pathname = vncUrl.pathname
78 url.protocol = url.protocol === 'https:' ? 'wss:' : 'ws:'
79 vnc = url.href
80 } catch (error) {
81 console.log(error)
82 }
83 }
84 const name: string = parsed['se:name'] ?? id
85 return {
86 id,
87 capabilities,
88 browserName,
89 browserVersion,
90 platformName,
91 startTime,
92 uri,
93 nodeId,
94 nodeUri,
95 sessionDurationMillis,
96 slot,
97 vnc,
98 name
99 }
100}
101
102export default SessionData

Callers 2

RunningSessionsFunction · 0.90

Calls 2

logMethod · 0.65
parseMethod · 0.45

Tested by

no test coverage detected