cyrus-and / chrome-har-capturer

Capture HAR files from a Chrome instance
MIT License
535 stars 90 forks source link

Android connection has working socket, but gives 'Not supported' message #63

Closed fafnirbcrow closed 6 years ago

fafnirbcrow commented 6 years ago
Component Version
Operating system OSx/Linux
Node.js c8.9.4
Chrome/Chromium/... Android 67.0.3396.81
chrome-remote-interface 0.25.6

Is Chrome running in a container? NO

So having a issue similar to https://github.com/cyrus-and/chrome-remote-interface/issues/332 and am able to get past the socket hang up/protocol local issue.

Once through that however, I am getting 'Not supported' as an error message, and the program does not exit.

I am using the force option on the run also, as thinking that may be related, but it did not solve the problem.

For my command line run, I just simplified the CLI version a hair, attached below

let url = ['https://github.com'];

let host = 'localhost';
let port = 9222;
let parallel = false;
let force = true;

H.run(url, {
    host, port, force
}).on('load', (url) => {
    console.log(`- ${prettify(url)} `);
    if (parallel) {
        log('…\n');
    }
}).on('done', (url) => {
    if (parallel) {
        console.log(`- ${prettify(url)} `);
    }
    log('✓\n');
}).on('fail', (url, err) => {
    if (parallel) {
        console.log(`- ${prettify(url)} `);
    }
    console.log(`✗\n  ${err.message}\n`);
}).on('har', (har) => {
    //const fs = require('fs');
    const json = JSON.stringify(har, null, 4);
    /*const output = program.output
        ? fs.createWriteStream(program.output)
        : process.stdout;
    output.write(json);
    output.write('\n');*/
    console.log(json);
    console.log('\n');
});
cyrus-and commented 6 years ago

Eh... they have apparently killed Target.createBrowserContext on Android and the reason escapes me.

You can workaround by passing the -k, --cache option but you won't have the usual cache/dns isolation.

cyrus-and commented 6 years ago

Asked in the Google Group.

cyrus-and commented 6 years ago

I'm quoting the reply from the Google Group:

Target.createBrowserContext has been implemented in headless embedder for a while. However, headful implementation was added only in Chrome 68: https://crrev.com/553323

cyrus-and commented 6 years ago

Eh... they have apparently killed Target.createBrowserContext on Android and the reason escapes me.

This is wrong.