playstation: use better locator for sign in button
This commit is contained in:
parent
5ea6487d2b
commit
0b737807cf
2 changed files with 4 additions and 4 deletions
|
|
@ -64,10 +64,10 @@ async function main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function performLogin() {
|
async function performLogin() {
|
||||||
// the page gets stuck sometimes and requires a reload
|
// the page gets stuck sometimes and requires a reload
|
||||||
await retryOnError(() => page.goto(URL_CLAIM, { timeout: 20_000, waitUntil: "networkidle" }));
|
await retryOnError(() => page.goto(URL_CLAIM, { timeout: 20_000, waitUntil: "domcontentloaded" }));
|
||||||
|
|
||||||
const signInLocator = page.locator('span:has-text("Sign in")').first();
|
const signInLocator = page.locator('button[data-track-click="web:select-sign-in-button"]').first();
|
||||||
const profileIconLocator = page.locator(".profile-icon").first();
|
const profileIconLocator = page.locator(".profile-icon").first();
|
||||||
|
|
||||||
const mainPageBaseUrl = "https://playstation.com";
|
const mainPageBaseUrl = "https://playstation.com";
|
||||||
|
|
|
||||||
2
util.js
2
util.js
|
|
@ -34,7 +34,7 @@ export const retryOnError = (promiseFn, maxRetries = 1) => {
|
||||||
resolve(result);
|
resolve(result);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (remainingRetries > 0) {
|
if (remainingRetries > 0) {
|
||||||
console.log(`Retrying... ${remainingRetries} retries left.`);
|
console.log(`Retrying... ${remainingRetries - 1} retries left.`);
|
||||||
executePromise(remainingRetries - 1); // Retry the Promise with one less retry
|
executePromise(remainingRetries - 1); // Retry the Promise with one less retry
|
||||||
} else {
|
} else {
|
||||||
reject(error); // No more retries left, reject with the last error
|
reject(error); // No more retries left, reject with the last error
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue