From a231476d3a1c6a921b36d5445a5bee928bf4b0c6 Mon Sep 17 00:00:00 2001 From: XEGARE Date: Wed, 26 Jan 2022 12:05:01 +0500 Subject: [PATCH 1/2] Changing the path to absolute --- epic-games.js | 2 +- prime-gaming.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/epic-games.js b/epic-games.js index 6015285..cd79284 100644 --- a/epic-games.js +++ b/epic-games.js @@ -9,7 +9,7 @@ const TIMEOUT = 20 * 1000; // 20s, default is 30s // could change to .mjs to get top-level-await, but would then also need to change require to import and dynamic import for stealth below would just add more async/await (async () => { // https://playwright.dev/docs/auth#multi-factor-authentication - const context = await chromium.launchPersistentContext('userDataDir', { + const context = await chromium.launchPersistentContext(`${__dirname}\\userDataDir`, { channel: 'chrome', // https://playwright.dev/docs/browsers#google-chrome--microsoft-edge headless: false, viewport: { width: 1280, height: 1280 }, diff --git a/prime-gaming.js b/prime-gaming.js index 912855e..b37e053 100644 --- a/prime-gaming.js +++ b/prime-gaming.js @@ -9,7 +9,7 @@ const TIMEOUT = 20 * 1000; // 20s, default is 30s // could change to .mjs to get top-level-await, but would then also need to change require to import and dynamic import for stealth below would just add more async/await (async () => { // https://playwright.dev/docs/auth#multi-factor-authentication - const context = await chromium.launchPersistentContext('userDataDir', { + const context = await chromium.launchPersistentContext(`${__dirname}\\userDataDir`, { channel: 'chrome', // https://playwright.dev/docs/browsers#google-chrome--microsoft-edge headless: false, viewport: { width: 1280, height: 1280 }, From 6b55c2b9d4ded6ff52a3c985a217e7af7b9df253 Mon Sep 17 00:00:00 2001 From: XEGARE Date: Mon, 31 Jan 2022 23:11:36 +0500 Subject: [PATCH 2/2] Fix path for macOS --- epic-games.js | 3 ++- prime-gaming.js | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/epic-games.js b/epic-games.js index cd79284..83984b3 100644 --- a/epic-games.js +++ b/epic-games.js @@ -1,5 +1,6 @@ //@ts-check const { chromium } = require('playwright'); // stealth plugin needs no outdated playwright-extra +const path = require('path'); const debug = process.env.PWDEBUG == '1'; // runs headful and opens https://playwright.dev/docs/inspector const URL_LOGIN = 'https://www.epicgames.com/login'; @@ -9,7 +10,7 @@ const TIMEOUT = 20 * 1000; // 20s, default is 30s // could change to .mjs to get top-level-await, but would then also need to change require to import and dynamic import for stealth below would just add more async/await (async () => { // https://playwright.dev/docs/auth#multi-factor-authentication - const context = await chromium.launchPersistentContext(`${__dirname}\\userDataDir`, { + const context = await chromium.launchPersistentContext(path.resolve(__dirname, 'userDataDir'), { channel: 'chrome', // https://playwright.dev/docs/browsers#google-chrome--microsoft-edge headless: false, viewport: { width: 1280, height: 1280 }, diff --git a/prime-gaming.js b/prime-gaming.js index b37e053..3d95f45 100644 --- a/prime-gaming.js +++ b/prime-gaming.js @@ -1,5 +1,6 @@ //@ts-check const { chromium } = require('playwright'); // stealth plugin needs no outdated playwright-extra +const path = require('path'); const debug = process.env.PWDEBUG == '1'; // runs headful and opens https://playwright.dev/docs/inspector // const URL_LOGIN = 'https://www.amazon.de/ap/signin'; // wrong. needs some session args to be valid? @@ -9,7 +10,7 @@ const TIMEOUT = 20 * 1000; // 20s, default is 30s // could change to .mjs to get top-level-await, but would then also need to change require to import and dynamic import for stealth below would just add more async/await (async () => { // https://playwright.dev/docs/auth#multi-factor-authentication - const context = await chromium.launchPersistentContext(`${__dirname}\\userDataDir`, { + const context = await chromium.launchPersistentContext(path.resolve(__dirname, 'userDataDir'), { channel: 'chrome', // https://playwright.dev/docs/browsers#google-chrome--microsoft-edge headless: false, viewport: { width: 1280, height: 1280 },