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

Function extractCommands

javascript/selenium-webdriver/generate_bidi.mjs:531–560  ·  view source on GitHub ↗

Extract all BiDi commands by traversing CommandData and extension XxxCommand unions.

(ast)

Source from the content-addressed store, hash-verified

529
530/** Extract all BiDi commands by traversing CommandData and extension XxxCommand unions. */
531function extractCommands(ast) {
532 const defMap = buildDefMap(ast)
533 const emptyParamTypes = buildEmptyParamTypes(ast)
534 const commandNames = collectAllMembers(defMap, 'Command')
535 const commands = []
536
537 for (const name of commandNames) {
538 const def = defMap.get(name)
539 if (!def) continue
540
541 const parsed = parseLeafDef(def)
542 if (!parsed) continue
543
544 const { domain, methodStr, operationName: methodName, paramsCddl, vendor } = parsed
545 // emptyParamTypes holds raw CDDL group names, so compare the raw name (not the normalized one).
546 const hasParams = paramsCddl !== null && !emptyParamTypes.has(paramsCddl)
547
548 commands.push({
549 domain,
550 cddlName: name,
551 methodStr,
552 methodName,
553 paramsCddl,
554 hasParams,
555 vendor,
556 })
557 }
558
559 return commands
560}
561
562/** Extract all BiDi events by traversing EventData and extension XxxEvent unions. */
563function extractEvents(ast) {

Callers 1

buildModelFunction · 0.85

Calls 7

buildDefMapFunction · 0.85
buildEmptyParamTypesFunction · 0.85
collectAllMembersFunction · 0.85
parseLeafDefFunction · 0.85
pushMethod · 0.80
getMethod · 0.65
hasMethod · 0.45

Tested by

no test coverage detected