-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Closed
Description
Context:
- Playwright Version: 0.13.0
- Operating System: Linux
- Extra: Heroku app
Code Snippet
const playwright = require('playwright');
const cookiePc = { name: 'platform', value: 'pc', domain: 'www.futbin.com', path: '/' };
module.exports = async (version, name, msg) => {
const url = `https://www.futbin.com/players?page=1&search=${name}&version=${searchversion}`;
//url example = https://www.futbin.com/players?page=1&search=maradona&version=mid_icons
try {
const browser = await playwright.chromium.launch();
const context = await browser.newContext();
const browserPage = await context.newPage();
await context.addCookies([cookiePc]);
await browserPage.goto(url);
const table = '#repTb tbody tr';
const playername = await browserPage.$eval(`${table} .player_name_players_table`, el => el.textContent);
const rating = await browserPage.$eval(`${table} td:nth-of-type(2) span`, el => el.textContent);
const position = await browserPage.$eval(`${table} td:nth-of-type(3)`, el => el.textContent);
const price = await browserPage.$eval(`${table} td:nth-of-type(5) span`, el => el.textContent);
const sm = await browserPage.$eval(`${table} td:nth-of-type(6)`, el => el.textContent);
const wf = await browserPage.$eval(`${table} td:nth-of-type(7)`, el => el.textContent);
const awr = await browserPage.$eval(`${table} td:nth-of-type(8) span:first-of-type`, el => el.textContent);
const dwr = await browserPage.$eval(`${table} td:nth-of-type(8) span:last-of-type`, el => el.textContent);
const linkp = await browserPage.$eval(`${table} .player_name_players_table`, el => el.href);
await browserPage.goto(linkp);
await browserPage.waitFor(750);
const lastUpdate = await browserPage.$eval('#pc-updated', el => el.textContent);
const chemStyle = await browserPage.$eval('.pgp_chem_val_tooltip', el => el.textContent);
const imgPlayer = await browserPage.$eval('#player_pic', img => img.src);
const adsSave = await browserPage.$('.banner_save--3Xnwp');
await adsSave.click();
const cookieClick = await browserPage.$('.cc-compliance a');
await cookieClick.click();
const graphClick = await browserPage.$('.highcharts-range-selector-buttons g:nth-of-type(2)');
await graphClick.click();
const graph = await browserPage.$('#daily_graph .highcharts-container');
await graph.screenshot({ path: './src/commands/futbin/icons/graph.jpg', type: 'jpeg', quality: 75 });
await browser.close();
} catch (err) {
console.error(`${err}. Icon command.`);
lastMsg.then(msg => msg.delete());
return msg.channel.send(msgEmbed.setTitle('An error has occurred, retry the command. If the error keeps happening contact @Staff'));
}
};The error that is being logged:
Error: Protocol error (Target.setAutoAttach): Target closed..
This is for a custom command on a Discord bot, when I was testing locally this worked perfectly fine. Almost never got any errors.
The moment I deployed my code to Heroku so it can be online all the time it gave me an instant error like this, and the error message happens almost instantly after the command was typed in so it must be happening very early in the process. Not sure if this is a Playwright error or something to do with Heroku but any help here would be very appreciated.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels