MCPcopy Index your code
hub / github.com/SeleniumHQ/selenium / pinScript

Method pinScript

javascript/selenium-webdriver/lib/webdriver.js:1549–1573  ·  view source on GitHub ↗
(script)

Source from the content-addressed store, hash-verified

1547 }
1548
1549 async pinScript(script) {
1550 let pinnedScript = new PinnedScript(script)
1551 let connection
1552 if (Object.is(this._cdpConnection, undefined)) {
1553 connection = await this.createCDPConnection('page')
1554 } else {
1555 connection = this._cdpConnection
1556 }
1557
1558 await connection.send('Page.enable', {})
1559
1560 await connection.send('Runtime.evaluate', {
1561 expression: pinnedScript.creationScript(),
1562 })
1563
1564 let result = await connection.send('Page.addScriptToEvaluateOnNewDocument', {
1565 source: pinnedScript.creationScript(),
1566 })
1567
1568 pinnedScript.scriptId = result['result']['identifier']
1569
1570 this.pinnedScripts_[pinnedScript.handle] = pinnedScript
1571
1572 return pinnedScript
1573 }
1574
1575 async unpinScript(script) {
1576 if (script && !(script instanceof PinnedScript)) {

Callers 1

devtools_test.jsFile · 0.80

Calls 4

createCDPConnectionMethod · 0.95
creationScriptMethod · 0.95
isMethod · 0.65
sendMethod · 0.65

Tested by

no test coverage detected