I am trying to scrape from an MT5 server. On my browser the site shows loading for a few seconds or milliseconds then renders the login form. But with puppeter it doesn't. Just the loading page like forever, till timeout. And when i try to code puppeteer wait until the element is rendered it crashes after timeout. I have tried different methods to find out whats wrong(Some of which i commented out in my code). I don't know where i got it wrong or is it from the site?
This is my first time using Puppeteer too. My Code is below. Any body that can help me out with solutions?
const puppeteer = require("puppeteer");
const baseUrl = "https://trade.mql5.com/trade?servers=";
const getData = async () => {
console.log(baseUrl);
// launch pupprteer
const browser = await puppeteer.launch({ headless: false });
const page = await browser.newPage();
// await page.setDefaultNavigationTimeout(60000);
await page.goto(baseUrl, { waitUntil: "networkidle2", timeout: 0 });
// await page.waitForNavigation(() =>
// document.querySelector("#hero-head-circle")
// );
// await page.screenshot({ path: "login.png" });
await page.waitForSelector("#login"),
await page.screenshot({ path: "login.png" });
await browser.close();
};
getData();