File tree Expand file tree Collapse file tree 1 file changed +16
-11
lines changed Expand file tree Collapse file tree 1 file changed +16
-11
lines changed Original file line number Diff line number Diff line change @@ -8,15 +8,20 @@ const puppeteer = require('puppeteer');
8
8
// Navigate the page to a URL
9
9
await page . goto ( 'https://pptr.dev/' ) ;
10
10
11
- // Hints:
12
- // Click search button
13
- // Type into search box
14
- // Wait for search result
15
- // Get the `Docs` result section
16
- // Click on first result in `Docs` section
17
- // Locate the title
18
- // Print the title
19
-
20
- // Close the browser
11
+ await page . waitForSelector ( '.DocSearch-Button' ) ;
12
+ await page . click ( '.DocSearch-Button' ) ;
13
+
14
+ await page . waitForSelector ( '.DocSearch-Form' ) ;
15
+ await page . keyboard . type ( 'chipi chipi chapa chapa' ) ;
16
+
17
+ await page . waitForSelector ( '#docsearch-item-5 a[href="/webdriver-bidi/#measuring-progress"]' ) ;
18
+ await page . click ( '#docsearch-item-5 a[href="/webdriver-bidi/#measuring-progress"]' ) ;
19
+
20
+ await new Promise ( resolve => setTimeout ( resolve , 2000 ) ) ;
21
+
22
+ const fullTitle = await page . title ( ) ;
23
+ const desiredTitle = fullTitle . split ( ' | ' ) [ 0 ] ;
24
+ console . log ( desiredTitle ) ;
25
+
21
26
await browser . close ( ) ;
22
- } ) ( ) ;
27
+ } ) ( ) ;
You can’t perform that action at this time.
0 commit comments