1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "startUrl": "https://example.com",
12 "actions": [
13 {
14 "type": "waitForSelector",
15 "locator": {
16 "by": "css",
17 "value": "h1"
18 }
19 },
20 {
21 "type": "extractText",
22 "locator": {
23 "by": "css",
24 "value": "h1"
25 }
26 },
27 {
28 "type": "textContains",
29 "locator": {
30 "by": "css",
31 "value": "h1"
32 },
33 "expected": "Example Domain"
34 }
35 ],
36 "proxyConfiguration": {
37 "useApifyProxy": false
38 }
39};
40
41
42const run = await client.actor("produkdigitalali/playwright-browser-automation-runner").call(input);
43
44
45console.log('Results from dataset');
46console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
47const { items } = await client.dataset(run.defaultDatasetId).listItems();
48items.forEach((item) => {
49 console.dir(item);
50});
51
52