-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathremote-debugging-protocol.txt
More file actions
108 lines (83 loc) · 2.73 KB
/
remote-debugging-protocol.txt
File metadata and controls
108 lines (83 loc) · 2.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
https://github.com/GoogleChrome/puppeteer
https://github.com/GoogleChrome/puppeteer/blob/master/lib/Launcher.js
https://github.com/GoogleChrome/puppeteer/tree/master/lib
https://try-puppeteer.appspot.com/
https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-captureScreenshot
https://medium.com/@dschnr/using-headless-chrome-as-an-automated-screenshot-tool-4b07dffba79a?1
https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907
http://blog.masterdevs.com/chrome-debugging-api/
https://www.nuget.org/packages/MasterDevs.ChromeDevTools/
https://github.com/MasterDevs/ChromeDevTools
https://chromedevtools.github.io/devtools-protocol/
https://github.com/ChromeDevTools/awesome-chrome-devtools#chrome-devtools-protocol
http://compatibility.remotedebug.org/Emulation/Chrome%20(CDP%201.2)/commands/setVisibleSize
http://compatibility.remotedebug.org/Page/Chrome%20(CDP%201.2)/commands/captureScreenshot
https://github.com/cyrus-and/chrome-remote-interface/wiki/Take-page-screenshot
https://www.npmjs.com/package/chrome-devtools-protocol-screenshot
https://github.com/google/ios-webkit-debug-proxy
----
https://github.com/GoogleChrome/puppeteer/blob/master/lib/FrameManager.js#L729
async function waitForPredicatePageFunction(predicateBody, polling, timeout) {
const predicate = new Function(predicateBody);
let timedOut = false;
setTimeout(() => timedOut = true, timeout);
if (polling === 'raf')
await pollRaf();
else if (polling === 'mutation')
await pollMutation();
else if (typeof polling === 'number')
await pollInterval(polling);
return !timedOut;
/**
* @return {!Promise}
*/
function pollMutation() {
if (predicate())
return Promise.resolve();
let fulfill;
const result = new Promise(x => fulfill = x);
const observer = new MutationObserver(mutations => {
if (timedOut || predicate()) {
observer.disconnect();
fulfill();
}
});
observer.observe(document, {
childList: true,
subtree: true,
attributes: true
});
return result;
}
/**
* @return {!Promise}
*/
function pollRaf() {
let fulfill;
const result = new Promise(x => fulfill = x);
onRaf();
return result;
function onRaf() {
if (timedOut || predicate())
fulfill();
else
requestAnimationFrame(onRaf);
}
}
/**
* @param {number} pollInterval
* @return {!Promise}
*/
function pollInterval(pollInterval) {
let fulfill;
const result = new Promise(x => fulfill = x);
onTimeout();
return result;
function onTimeout() {
if (timedOut || predicate())
fulfill();
else
setTimeout(onTimeout, pollInterval);
}
}
}