From 181af4e2b72cc2d5a97a7d82cf5a885d2fd8e3a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matou=C5=A1=20Ma=C5=99=C3=ADk?= <63095344+MatousMarik@users.noreply.github.com> Date: Thu, 12 Sep 2024 14:51:09 +0200 Subject: [PATCH 01/12] Update mini_project.md typo TypeScript will yell when 'images' is not present - removeImages: true --- sources/academy/webscraping/typescript/mini_project.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/academy/webscraping/typescript/mini_project.md b/sources/academy/webscraping/typescript/mini_project.md index 014bc2cd61..1bfd7e7b6b 100644 --- a/sources/academy/webscraping/typescript/mini_project.md +++ b/sources/academy/webscraping/typescript/mini_project.md @@ -366,7 +366,7 @@ async function scrape(input: UserInput) { } ``` -Now, we can access `result[0].images` on the return value of `scrape` if **removeImages** was false without any compiler errors being thrown. But, if we switch **removeImages** to false, TypeScript will yell at us. +Now, we can access `result[0].images` on the return value of `scrape` if **removeImages** was false without any compiler errors being thrown. But, if we switch **removeImages** to true, TypeScript will yell at us. ![No more error](./images/no-more-error.png) From 30953135d51f4e67f6cc9010d396b3fd4df029b7 Mon Sep 17 00:00:00 2001 From: Matous Marik Date: Tue, 17 Sep 2024 09:11:35 +0200 Subject: [PATCH 02/12] typo --- .../platform/expert_scraping_with_apify/tasks_and_storage.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/academy/platform/expert_scraping_with_apify/tasks_and_storage.md b/sources/academy/platform/expert_scraping_with_apify/tasks_and_storage.md index 8d42fc6d18..853f7d80c3 100644 --- a/sources/academy/platform/expert_scraping_with_apify/tasks_and_storage.md +++ b/sources/academy/platform/expert_scraping_with_apify/tasks_and_storage.md @@ -40,7 +40,7 @@ Once again, we'll be adding onto our main Amazon-scraping Actor in this activity We have decided that we want to retain the data scraped by the Actor for a long period of time, so instead of pushing to the default dataset, we will be pushing to a named dataset. Additionally, we want to save the absolute cheapest item found by the scraper into the default key-value store under a key named **CHEAPEST-ITEM**. -Finally, we'll create a task for the Actor that saves the configuration with the **keyword** set to **google pixel****. +Finally, we'll create a task for the Actor that saves the configuration with the **keyword** set to **google pixel**. [**Solution**](./solutions/using_storage_creating_tasks.md) From 2e17a7ed450bc35fce95d14db278aed9fe478622 Mon Sep 17 00:00:00 2001 From: Matous Marik Date: Tue, 17 Sep 2024 09:38:05 +0200 Subject: [PATCH 03/12] Google accept cookies button is not "I agree" but "Accept all" --- .../page/interacting_with_a_page.md | 10 +++++----- .../puppeteer_playwright/page/page_methods.md | 2 +- .../webscraping/puppeteer_playwright/page/waiting.md | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/sources/academy/webscraping/puppeteer_playwright/page/interacting_with_a_page.md b/sources/academy/webscraping/puppeteer_playwright/page/interacting_with_a_page.md index db20f04a98..5d71cece0d 100644 --- a/sources/academy/webscraping/puppeteer_playwright/page/interacting_with_a_page.md +++ b/sources/academy/webscraping/puppeteer_playwright/page/interacting_with_a_page.md @@ -36,7 +36,7 @@ Let's first focus on the first 3 steps listed above. By using `page.click()` and ```js -// Click the "I agree" button +// Click the "Accept all" button await page.click('button:has-text("Accept all")'); ``` @@ -44,7 +44,7 @@ await page.click('button:has-text("Accept all")'); ```js -// Click the "I agree" button +// Click the "Accept all" button await page.click('button + button'); ``` @@ -53,7 +53,7 @@ await page.click('button + button'); With `page.click()`, Puppeteer and Playwright actually drag the mouse and click, allowing the bot to act more human-like. This is different from programmatically clicking with `Element.click()` in vanilla client-side JavaScript. -Notice that in the Playwright example, we are using a different selector than in the Puppeteer example. This is because Playwright supports [many custom CSS selectors](https://playwright.dev/docs/other-locators#css-elements-matching-one-of-the-conditions), such as the **has-text** pseudo class. As a rule of thumb, using text selectors is much more preferable to using regular selectors, as they are much less likely to break. If Google makes the sibling above the **I agree** button a `
` element instead of a `