Skip to content

Commit fdbe43a

Browse files
authored
Update main_test.js
1 parent e772bf2 commit fdbe43a

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

lab4/main_test.js

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,18 @@ const puppeteer = require('puppeteer');
88
// Navigate the page to a URL
99
await page.goto('https://pptr.dev/');
1010

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
11+
await page.waitForSelector('.DocSearch-Button');
12+
await page.click('.DocSearch-Button');
1913

20-
// Close the browser
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 title = await page.title();
23+
console.log('Page Title:', title);
2124
await browser.close();
22-
})();
25+
})();

0 commit comments

Comments
 (0)