Skip to main content

Puppeteer

Updated over 2 weeks ago

💡Note:

  1. The MoreLogin version should be no lower than 2.32.0

  2. The port may not necessarily be 40000. You can check it at the API entry in the client.

const puppeteer = require("puppeteer");

const axios = require("axios");

async function debugPort(profileId) {

const url = `http://localhost:40000/api/env/start`;

const response = await axios.post(url, { envId: profileId });

if (response.data.code === 0) {

return response.data.data.debugPort;

}

return -1;

}

(async function run() {

const port = await debugPort("1907340050417491968");

if (port <= 0) {

console.log("Failed to start the profile");

return;

}

const browserURL = `http://127.0.0.1:${port}`;

const browser = await puppeteer.connect({ browserURL });

const page = await browser.newPage();

await page.goto("https://google.com");

})();


Need more help? Contact us:


Did this answer your question?