-
Notifications
You must be signed in to change notification settings - Fork 311
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to get respond data from a request endpoint? #520
Comments
Something like this:
Hope it helps! |
Thank you, I got it working on local now. Now I have an issue with running it on AWS Lambda. It can't open chrome browser there. How can I fix that? |
Headless mode? |
Yes, but seems we need to use puppeteer to open page. |
Why...? Have you even tried? |
This is my code, can you take a look? I tested on local but doesn't work well, seems it can't open the page.
|
You cannot load pages in the browser context ( I don't think you need Puppeteer at all, just const CDP = require('chrome-remote-interface');
const ChromeLauncher = require('chrome-launcher');
(async () => {
const chrome = await ChromeLauncher.launch({
chromeFlags: [
'--headless'
]
});
const client = await CDP({
port: chrome.port
});
const {Page, Network} = client;
Network.requestWillBeSent(({request}) => {
console.log(request.url);
});
await Page.navigate({
url: 'http://github.com'
});
await Page.enable();
await Network.enable();
await Page.loadEventFired();
await client.close();
await chrome.kill();
})(); |
Thanks for suggesion, I got error for chromePath as below. If it's on AWS lambda, I think we still need
|
Then use the version from const chromium = require('chrome-aws-lambda');
// ...
const chrome = await ChromeLauncher.launch({
chromePath: await chromium.executablePath,
chromeFlags: [
'--headless'
]
}); Also see alixaxel/chrome-aws-lambda#86. |
Thank you for support, I will take a look. Hope this will work. |
Hello,
I've searched around the docs and other's discussions but can't found the answer. I make a request to visit a website which sends request to API endpoints. These API endpoints reply with data, I want to get this data.
This API endpoint has been protected and can't get by HTTP request with axios or normal fetching method. The only way to get it is
chrome-remote-interface
Here is my code:
Thank you alot for help.
The text was updated successfully, but these errors were encountered: