File tree 1 file changed +6
-8
lines changed
1 file changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -20,15 +20,13 @@ const puppeteer = require('puppeteer');
20
20
await page . type ( searchInputSelector , 'chipi chipi chapa chapa' ) ;
21
21
22
22
// Wait for and click the first search result in the Docs section (obfuscated selector)
23
- const firstResultSelector = '#docsearch-item-5 > a' ;
24
- await page . waitForSelector ( firstResultSelector , { timeout : 3000 } ) ;
25
- await page . click ( firstResultSelector ) ;
26
-
23
+ await page . waitForSelector ( '.DocSearch-Hit-source' ) ;
24
+ const firstResult = await page . $ ( '.DocSearch-Hit-source' , { timeout : 3000 } ) ;
25
+ await firstResult . click ( )
27
26
// Extract and print the title
28
- const titleSelector = 'h1' ; // Maintained clear selector for readability
29
- await page . waitForSelector ( titleSelector ) ;
30
- const titleElement = await page . $ ( titleSelector ) ;
31
- const titleText = await page . evaluate ( el => el . textContent , titleElement ) ;
27
+ await page . waitForSelector ( 'h1' )
28
+ const titleElement = await page . $ ( 'h1' ) ;
29
+ const titleText = await page . evaluate ( el => el . textContent , titleElement ) ;
32
30
console . log ( titleText ) ;
33
31
34
32
// Close the browser
You can’t perform that action at this time.
0 commit comments