Update index.js
Browse files
index.js
CHANGED
|
@@ -5,21 +5,22 @@ const { chromium } = require('playwright');
|
|
| 5 |
headless: true,
|
| 6 |
args: ['--no-sandbox', '--disable-setuid-sandbox', '--disable-dev-shm-usage']
|
| 7 |
});
|
| 8 |
-
const
|
|
|
|
| 9 |
|
| 10 |
try {
|
| 11 |
-
await page.setExtraHTTPHeaders({
|
| 12 |
-
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36'
|
| 13 |
-
});
|
| 14 |
-
|
| 15 |
await page.goto('https://en.ephoto360.com/create-3d-colorful-paint-text-effect-online-801.html', {
|
| 16 |
waitUntil: 'domcontentloaded',
|
| 17 |
timeout: 90000
|
| 18 |
});
|
| 19 |
|
| 20 |
-
|
|
|
|
|
|
|
|
|
|
| 21 |
await page.fill('input[name="text[]"]', 'TEST TEXT');
|
| 22 |
|
|
|
|
| 23 |
await page.click('input[value="GO"]');
|
| 24 |
|
| 25 |
await page.waitForTimeout(45000);
|
|
@@ -36,10 +37,7 @@ const { chromium } = require('playwright');
|
|
| 36 |
|
| 37 |
console.log('Generated image:', imageUrl || 'not found');
|
| 38 |
|
| 39 |
-
if (!imageUrl) {
|
| 40 |
-
await page.screenshot({ path: 'debug.png', fullPage: true });
|
| 41 |
-
console.log('Screenshot saved: debug.png');
|
| 42 |
-
}
|
| 43 |
|
| 44 |
} catch (err) {
|
| 45 |
console.error('Error:', err.message);
|
|
|
|
| 5 |
headless: true,
|
| 6 |
args: ['--no-sandbox', '--disable-setuid-sandbox', '--disable-dev-shm-usage']
|
| 7 |
});
|
| 8 |
+
const context = await browser.newContext();
|
| 9 |
+
const page = await context.newPage();
|
| 10 |
|
| 11 |
try {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
await page.goto('https://en.ephoto360.com/create-3d-colorful-paint-text-effect-online-801.html', {
|
| 13 |
waitUntil: 'domcontentloaded',
|
| 14 |
timeout: 90000
|
| 15 |
});
|
| 16 |
|
| 17 |
+
// Reload once to stabilize JS
|
| 18 |
+
await page.reload({ waitUntil: 'domcontentloaded', timeout: 60000 });
|
| 19 |
+
|
| 20 |
+
await page.waitForSelector('input[name="text[]"]', { state: 'visible', timeout: 40000 });
|
| 21 |
await page.fill('input[name="text[]"]', 'TEST TEXT');
|
| 22 |
|
| 23 |
+
await page.waitForSelector('input[value="GO"]', { state: 'visible' });
|
| 24 |
await page.click('input[value="GO"]');
|
| 25 |
|
| 26 |
await page.waitForTimeout(45000);
|
|
|
|
| 37 |
|
| 38 |
console.log('Generated image:', imageUrl || 'not found');
|
| 39 |
|
| 40 |
+
if (!imageUrl) await page.screenshot({ path: 'debug.png', fullPage: true });
|
|
|
|
|
|
|
|
|
|
| 41 |
|
| 42 |
} catch (err) {
|
| 43 |
console.error('Error:', err.message);
|