From 6e094c4594386f2d1e2c8d1238b6df1a6fb00987 Mon Sep 17 00:00:00 2001 From: mr-paperbag <116077581+mr-paperbag@users.noreply.github.com> Date: Sun, 6 Aug 2023 03:17:53 +0200 Subject: [PATCH] Update interacting_with_a_page.md Google now has a textarea field as opposed to input field. Also added a note about title="search" differing depending on language. --- .../page/interacting_with_a_page.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 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 f05cf33c6..58fa189c5 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 @@ -59,11 +59,11 @@ Notice that in the Playwright example, we are using a different selector than in > If you're not already familiar with CSS selectors and how to find them, we recommend referring to [this lesson](../../web_scraping_for_beginners/data_extraction/using_devtools.md) in the **Web scraping for beginners** course. -Then, we can type some text into an input field with `page.type()`; passing a CSS selector as the first, and the string to input as the second parameter: +Then, we can type some text into a textarea field with `page.type()`; passing a CSS selector as the first, and the string to textarea as the second parameter (Note that "Search" might differ depending on the default language for Google): ```js // Type the query into the search box -await page.type('input[title="Search"]', 'hello world'); +await page.type('textarea[title="Search"]', 'hello world'); ``` Finally, we can press a single key by accessing the `keyboard` property of `page` and calling the `press()` function on it: @@ -91,7 +91,7 @@ await page.goto('https://google.com/'); await page.click('button:has-text("I agree")'); // Type the query into the search box -await page.type('input[title="Search"]', 'hello world'); +await page.type('textarea[title="Search"]', 'hello world'); // Press enter await page.keyboard.press('Enter'); @@ -116,7 +116,7 @@ await page.goto('https://google.com/'); await page.click('button + button'); // Type the query into the search box -await page.type('input[title="Search"]', 'hello world'); +await page.type('textarea[title="Search"]', 'hello world'); // Press enter await page.keyboard.press('Enter'); @@ -148,7 +148,7 @@ await page.goto('https://google.com/'); await page.click('button:has-text("I agree")'); -await page.type('input[title="Search"]', 'hello world'); +await page.type('textarea[title="Search"]', 'hello world'); await page.keyboard.press('Enter'); @@ -174,7 +174,7 @@ await page.goto('https://google.com/'); await page.click('button + button'); -await page.type('input[title="Search"]', 'hello world'); +await page.type('textarea[title="Search"]', 'hello world'); await page.keyboard.press('Enter');