Skip to content

Commit 9c6ffd8

Browse files
committed
feat: lab4 ok
1 parent 9f85fc6 commit 9c6ffd8

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

lab4/main_test.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,20 @@ const puppeteer = require('puppeteer');
1717
// Locate the title
1818
// Print the title
1919

20+
await page.click('.DocSearch-Button');
21+
const searchBoxSelector = '.DocSearch-Input';
22+
await page.waitForSelector(searchBoxSelector);
23+
await page.type(searchBoxSelector, 'andy popoo');
24+
25+
await page.locator('#docsearch-hits1-item-4 > a:nth-child(1) > div:nth-child(1)').click();
26+
// await page.waitForSelector(`.theme-doc-markdown > header:nth-child(1) > h1:nth-child(1)').innerText`);
27+
await new Promise(r => setTimeout(r, 1000));
28+
title = await page.evaluate(`document.querySelector('.theme-doc-markdown > header:nth-child(1) > h1:nth-child(1)').innerText `);
29+
console.log(title);
30+
31+
await page.screenshot({path: 'screenshot.png'});
32+
33+
2034
// Close the browser
2135
await browser.close();
22-
})();
36+
})();

0 commit comments

Comments
 (0)