12 lines
462 B
JavaScript
12 lines
462 B
JavaScript
const browser = require('../browser');
|
|
|
|
module.exports = async ({ type = null, url = null, method = null }) => {
|
|
await browser.start();
|
|
const filter = {};
|
|
if (type) filter.type = type;
|
|
if (url) filter.url = url;
|
|
if (method) filter.method = method;
|
|
const logs = Object.keys(filter).length > 0 ? await browser.getNetworkLogs(filter) : await browser.getNetworkLogs();
|
|
return { success: true, action: 'get_network_logs', count: logs.length, logs };
|
|
};
|