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

Function extractCommands

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

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

(ast)

Source from the content-addressed store, hash-verified

506
507/** Extract all BiDi commands by traversing CommandData and extension XxxCommand unions. */
508function extractCommands(ast) {
509 const defMap = buildDefMap(ast)
510 const emptyParamTypes = buildEmptyParamTypes(ast)
511 const commandNames = collectAllMembers(defMap, 'Command')
512 const commands = []
513
514 for (const name of commandNames) {
515 const def = defMap.get(name)
516 if (!def) continue
517
518 const parsed = parseLeafDef(def)
519 if (!parsed) continue
520
521 const { domain, methodStr, operationName: methodName, paramsCddl, vendor } = parsed
522 // emptyParamTypes holds raw CDDL group names, so compare the raw name (not the normalized one).
523 const hasParams = paramsCddl !== null && !emptyParamTypes.has(paramsCddl)
524
525 commands.push({
526 domain,
527 cddlName: name,
528 methodStr,
529 methodName,
530 paramsCddl,
531 hasParams,
532 vendor,
533 })
534 }
535
536 return commands
537}
538
539/** Extract all BiDi events by traversing EventData and extension XxxEvent unions. */
540function extractEvents(ast) {

Callers 1

buildModelFunction · 0.85

Calls 6

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

Tested by

no test coverage detected