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://quotes.toscrape.com/js/",
12 "actions": [
13 {
14 "type": "waitForSelector",
15 "locator": {
16 "by": "css",
17 "value": ".quote",
18 "index": 0
19 }
20 },
21 {
22 "type": "extractText",
23 "locator": {
24 "by": "css",
25 "value": ".quote .text",
26 "index": 0
27 }
28 },
29 {
30 "type": "extractText",
31 "locator": {
32 "by": "css",
33 "value": ".quote .author",
34 "index": 0
35 }
36 },
37 {
38 "type": "screenshot",
39 "name": "quotes-page"
40 }
41 ],
42 "proxyConfiguration": {
43 "useApifyProxy": false
44 }
45};
46
47
48const run = await client.actor("produkdigitalali/playwright-browser-automation-runner").call(input);
49
50
51console.log('Results from dataset');
52console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
53const { items } = await client.dataset(run.defaultDatasetId).listItems();
54items.forEach((item) => {
55 console.dir(item);
56});
57
58