MCPcopy
hub / github.com/vitejs/vite / toEl

Function toEl

playground/test-utils.ts:97–111  ·  view source on GitHub ↗
(
  el: string | ElementHandle | Locator,
)

Source from the content-addressed store, hash-verified

95}
96
97async function toEl(
98 el: string | ElementHandle | Locator,
99): Promise<ElementHandle> {
100 if (typeof el === 'string') {
101 const realEl = await page.$(el)
102 if (realEl == null) {
103 throw new Error(`Cannot find element: "${el}"`)
104 }
105 return realEl
106 }
107 if ('elementHandle' in el) {
108 return el.elementHandle()
109 }
110 return el
111}
112
113export async function getColor(
114 el: string | ElementHandle | Locator,

Callers 3

getColorFunction · 0.85
getBgFunction · 0.85
getBgColorFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected