MCPcopy Index your code
hub / github.com/codeceptjs/CodeceptJS / targetCreatedHandler

Function targetCreatedHandler

lib/helper/Puppeteer.js:3450–3473  ·  view source on GitHub ↗
(page)

Source from the content-addressed store, hash-verified

3448}
3449
3450async function targetCreatedHandler(page) {
3451 if (!page) return
3452 this.withinLocator = null
3453 page.on('load', () => {
3454 page
3455 .$('body')
3456 .catch(() => null)
3457 .then(context => (this.context = context))
3458 })
3459 page.on('console', msg => {
3460 this.debugSection(`Browser:${ucfirst(msg.type())}`, (msg._text || '') + msg.args().join(' '))
3461 consoleLogStore.add(msg)
3462 })
3463
3464 if (this.options.userAgent) {
3465 await page.setUserAgent(this.options.userAgent)
3466 }
3467 if (this.options.windowSize && this.options.windowSize.indexOf('x') > 0) {
3468 const dimensions = this.options.windowSize.split('x')
3469 const width = parseInt(dimensions[0], 10)
3470 const height = parseInt(dimensions[1], 10)
3471 await page.setViewport({ width, height })
3472 }
3473}
3474
3475// BC compatibility for Puppeteer < 10
3476async function getClickablePoint(el) {

Callers

nothing calls this directly

Calls 4

ucfirstFunction · 0.90
$Method · 0.80
typeMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected