Skip to content

Commit fe3f762

Browse files
authored
fix: debug cdp json issue
1 parent 7880d26 commit fe3f762

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

lib/commands/contexts.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,14 +166,15 @@ export async function getWebViewDetails(this: NovaWindowsDriver, waitForWebviewM
166166

167167
const waitMs = waitForWebviewMs ? Number(waitForWebviewMs) : 0;
168168
if (waitMs) {
169+
this.log.debug(`waiting for ${waitMs} ms`);
169170
await sleep(waitMs);
170171
}
171172

172173
const host = 'localhost';
173174
const port = this.webviewDevtoolsPort;
174175
const webViewDetails: WebViewDetails = {
175-
info: await cdpRequest<CDPVersionResponse>({ host, port, endpoint: '/json/version', timeout: 10000 }),
176-
pages: await cdpRequest<CDPListResponse>({ host, port, endpoint: '/json/list', timeout: 10000 }),
176+
info: await cdpRequest.call(this, ({ host, port, endpoint: '/json/version', timeout: 10000 })),
177+
pages: await cdpRequest.call(this, ({ host, port, endpoint: '/json/list', timeout: 10000 })),
177178
};
178179

179180
return webViewDetails;
@@ -237,7 +238,11 @@ async function getDriverExecutable(this: NovaWindowsDriver, browserType: 'Edge'
237238
return finalPath;
238239
}
239240

240-
async function cdpRequest<T = unknown>({ host, port, endpoint, timeout }): Promise<T> {
241+
async function cdpRequest<T = unknown>(this: NovaWindowsDriver, { host, port, endpoint, timeout }): Promise<T> {
242+
if (this?.log) {
243+
this.log.debug(`Sending request to ${host}:${port}${endpoint}`);
244+
}
245+
241246
return new Promise<T>((resolve, reject) => {
242247
const options = {
243248
hostname: host,

0 commit comments

Comments
 (0)