Spaces:
Paused
Paused
yaGeey commited on
Commit ·
72a2326
1
Parent(s): 545460d
again
Browse files- src/actions.ts +1 -33
- src/browser.ts +1 -1
src/actions.ts
CHANGED
|
@@ -71,41 +71,9 @@ export const addToPlaylistAction = async (page: Page) => {
|
|
| 71 |
// Wait for UI to settle
|
| 72 |
await page.waitForTimeout(2000)
|
| 73 |
|
| 74 |
-
// Log and dismiss any dialogs
|
| 75 |
-
const allDialogs = await page.locator('[role="dialog"]').count()
|
| 76 |
-
console.log(`Number of dialogs visible: ${allDialogs}`)
|
| 77 |
-
|
| 78 |
-
if (allDialogs > 0) {
|
| 79 |
-
// Try to dismiss dialogs with Escape key multiple times
|
| 80 |
-
console.log('Attempting to dismiss dialogs with Escape')
|
| 81 |
-
await page.keyboard.press('Escape').catch(() => {})
|
| 82 |
-
await page.waitForTimeout(300)
|
| 83 |
-
await page.keyboard.press('Escape').catch(() => {})
|
| 84 |
-
await page.waitForTimeout(300)
|
| 85 |
-
|
| 86 |
-
// Check for close buttons
|
| 87 |
-
const closeButtons = page.locator(
|
| 88 |
-
'[role="dialog"] button[aria-label*="close" i], [role="dialog"] button[aria-label*="dismiss" i]',
|
| 89 |
-
)
|
| 90 |
-
const closeCount = await closeButtons.count()
|
| 91 |
-
if (closeCount > 0) {
|
| 92 |
-
console.log(`Found ${closeCount} close buttons, clicking them`)
|
| 93 |
-
for (let i = 0; i < closeCount; i++) {
|
| 94 |
-
await closeButtons
|
| 95 |
-
.nth(i)
|
| 96 |
-
.click({ timeout: 1000 })
|
| 97 |
-
.catch(() => {})
|
| 98 |
-
await page.waitForTimeout(200)
|
| 99 |
-
}
|
| 100 |
-
}
|
| 101 |
-
|
| 102 |
-
await page.waitForTimeout(1000)
|
| 103 |
-
const remainingDialogs = await page.locator('[role="dialog"]').count()
|
| 104 |
-
console.log(`Dialogs remaining after dismiss attempt: ${remainingDialogs}`)
|
| 105 |
-
}
|
| 106 |
-
|
| 107 |
// Check if "Already added" dialog appeared (only if song was already in playlist)
|
| 108 |
const addAnywayBtn = page.getByRole('button', { name: /add anyway/i })
|
|
|
|
| 109 |
const isVisible = await addAnywayBtn.isVisible().catch(() => false)
|
| 110 |
console.log(`is "Add anyway" button visible? ${isVisible}`)
|
| 111 |
if (isVisible) {
|
|
|
|
| 71 |
// Wait for UI to settle
|
| 72 |
await page.waitForTimeout(2000)
|
| 73 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 74 |
// Check if "Already added" dialog appeared (only if song was already in playlist)
|
| 75 |
const addAnywayBtn = page.getByRole('button', { name: /add anyway/i })
|
| 76 |
+
await addAnywayBtn.waitFor({ timeout: 5000 }).catch(() => console.log('"Add anyway" button did not appear'))
|
| 77 |
const isVisible = await addAnywayBtn.isVisible().catch(() => false)
|
| 78 |
console.log(`is "Add anyway" button visible? ${isVisible}`)
|
| 79 |
if (isVisible) {
|
src/browser.ts
CHANGED
|
@@ -14,7 +14,7 @@ export async function createInstance() {
|
|
| 14 |
'--disable-setuid-sandbox',
|
| 15 |
'--disable-gpu',
|
| 16 |
'--no-first-run',
|
| 17 |
-
'--single-process',
|
| 18 |
'--mute-audio',
|
| 19 |
],
|
| 20 |
})
|
|
|
|
| 14 |
'--disable-setuid-sandbox',
|
| 15 |
'--disable-gpu',
|
| 16 |
'--no-first-run',
|
| 17 |
+
// '--single-process',
|
| 18 |
'--mute-audio',
|
| 19 |
],
|
| 20 |
})
|