'Wordpress site not opening on puppeteer
I am trying to open this site on chrome using puppeteer. But I am unable to open it. On Inspect it is sending a GET request to page and in response, the page has an empty body. However, when I try on a real chrome browser it is showing a website.
(async () => {
// Create an instance of the chrome browser
// But disable headless mode !
const browser = await puppeteer.launch({
headless: false,
executablePath: "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
});
const context = await browser.createIncognitoBrowserContext();
// Create a new page
const page = await context.newPage();
page.setBypassCSP(false);
page.setJavaScriptEnabled(true);
// Configure the navigation timeout
await page.setDefaultNavigationTimeout(0);
// Navigate to some website e.g Our Code World
await page.goto('https://mindcet.org/');
await page.waitForNavigation({'waitUntil': 'networkidle2'});
// Do your stuff
// ...
})();
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|