Neon-AI commited on
Commit
76dd3d4
·
verified ·
1 Parent(s): 624474f

Update index.js

Browse files
Files changed (1) hide show
  1. index.js +16 -2
index.js CHANGED
@@ -2,17 +2,31 @@ const { chromium } = require("playwright");
2
 
3
  (async () => {
4
 
5
- const browser = await chromium.launch();
 
 
 
 
 
 
 
 
6
  const page = await browser.newPage();
7
 
8
  await page.goto(
9
- "https://en.ephoto360.com/create-online-3d-comic-style-text-effects-817.html"
 
10
  );
11
 
 
 
 
12
  await page.fill('input[name="text[]"]', "HELLO");
13
 
 
14
  await page.click('button[type="submit"]');
15
 
 
16
  await page.waitForSelector(".thumbnail img");
17
 
18
  const img = await page.$eval(".thumbnail img", el => el.src);
 
2
 
3
  (async () => {
4
 
5
+ const browser = await chromium.launch({
6
+ headless: true,
7
+ args: [
8
+ "--no-sandbox",
9
+ "--disable-setuid-sandbox",
10
+ "--disable-dev-shm-usage"
11
+ ]
12
+ });
13
+
14
  const page = await browser.newPage();
15
 
16
  await page.goto(
17
+ "https://en.ephoto360.com/create-online-3d-comic-style-text-effects-817.html",
18
+ { waitUntil: "domcontentloaded" }
19
  );
20
 
21
+ // wait for the form input
22
+ await page.waitForSelector('input[name="text[]"]');
23
+
24
  await page.fill('input[name="text[]"]', "HELLO");
25
 
26
+ // click generate
27
  await page.click('button[type="submit"]');
28
 
29
+ // wait for result image
30
  await page.waitForSelector(".thumbnail img");
31
 
32
  const img = await page.$eval(".thumbnail img", el => el.src);