Skip to content

[LAB4] 512558007 #308

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 45 commits into from
Closed
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
b6022d7
Update main_test.js
n19971019 Apr 15, 2024
73e14e0
Update main_test.js
n19971019 Apr 15, 2024
e2d9010
Update main_test.js
n19971019 Apr 15, 2024
0fbe5c1
Update main_test.js
n19971019 Apr 15, 2024
ea36772
Update main_test.js
n19971019 Apr 15, 2024
53b1db8
Update main_test.js
n19971019 Apr 15, 2024
02bda22
Update main_test.js
n19971019 Apr 15, 2024
ee3d647
Update main_test.js
n19971019 Apr 15, 2024
c18d2f1
Update main_test.js
n19971019 Apr 15, 2024
d3f9be2
Update main_test.js
n19971019 Apr 15, 2024
5c75e1f
Update main_test.js
n19971019 Apr 15, 2024
c071a85
Update main_test.js
n19971019 Apr 15, 2024
cadfd44
Update main_test.js
n19971019 Apr 15, 2024
0c3008d
Update main_test.js
n19971019 Apr 15, 2024
19adf35
Update main_test.js
n19971019 Apr 15, 2024
bfbe77a
Update main_test.js
n19971019 Apr 15, 2024
1b55cc2
Update main_test.js
n19971019 Apr 15, 2024
e930381
Update main_test.js
n19971019 Apr 18, 2024
b7cf732
Update main_test.js
n19971019 Apr 18, 2024
0997cf7
Update main_test.js
n19971019 Apr 18, 2024
685713f
Merge branch '512558007' into lab4
n19971019 Apr 18, 2024
933bd83
Merge branch '512558007' into lab4
AlaRduTP Apr 18, 2024
b29a2bd
Update main_test.js
n19971019 Apr 18, 2024
bb8e46e
Update main_test.js
n19971019 Apr 18, 2024
0b36456
Update main_test.js
n19971019 Apr 18, 2024
4586424
Update main_test.js
n19971019 Apr 18, 2024
fd45324
Update main_test.js
n19971019 Apr 18, 2024
574729a
Update main_test.js
n19971019 Apr 18, 2024
b52bc0e
Update main_test.js
n19971019 Apr 18, 2024
48ee657
Update main_test.js
n19971019 Apr 18, 2024
b2f69bb
Update main_test.js
n19971019 Apr 18, 2024
ed901ed
Update main_test.js
n19971019 Apr 18, 2024
bd47565
Update main_test.js
n19971019 Apr 18, 2024
daf7e27
Update main_test.js
n19971019 Apr 18, 2024
ca5beae
Update main_test.js
n19971019 Apr 18, 2024
e3d672e
Update main_test.js
n19971019 Apr 18, 2024
08b1c32
Update main_test.js
n19971019 Apr 18, 2024
fcccd9b
Update main_test.js
n19971019 Apr 18, 2024
7455f49
Update main_test.js
n19971019 Apr 18, 2024
7182498
Update main_test.js
n19971019 Apr 18, 2024
9b6098b
Update main_test.js
n19971019 Apr 18, 2024
93f45a8
Update main_test.js
n19971019 Apr 18, 2024
60cf78b
Update main_test.js
n19971019 Apr 18, 2024
7cd1562
Update main_test.js
n19971019 Apr 18, 2024
ad2cb5b
Merge branch '512558007' into lab4
AlaRduTP Jun 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 25 additions & 13 deletions lab4/main_test.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,34 @@
const puppeteer = require('puppeteer');

(async () => {
// Launch the browser and open a new blank page
const browser = await puppeteer.launch();
// Launch browser and open a new page
let browser
browser = await puppeteer.launch();
const page = await browser.newPage();

// Navigate the page to a URL
// Navigate to the target URL
await page.goto('https://pptr.dev/');

// Hints:
// Click search button
// Type into search box
// Wait for search result
// Get the `Docs` result section
// Click on first result in `Docs` section
// Locate the title
// Print the title
// Locate and click the search button (obfuscated selector)
const searchBtnSelector = '.DocSearch-Button';
await page.waitForSelector(searchBtnSelector, { timeout: 2000 }); // Reduced timeout for speed
await page.click(searchBtnSelector);

// Type the search phrase into the search box (obfuscated selector)
const searchInputSelector = '.DocSearch-Input';
await page.waitForSelector(searchInputSelector, { timeout: 2000 });
await page.type(searchInputSelector, 'chipi chipi chapa chapa');

// Wait for and click the first search result in the Docs section (obfuscated selector)
await page.waitForSelector('.DocSearch-Hit-source');
const firstResult = await page.$('.DocSearch-Hit-source', { timeout: 3000 });
await firstResult.click()
// Extract and print the title
await page.waitForSelector('h1')
const titleElement = await page.$('h1');
const titleText = await page.evaluate(el => el.textContent, titleElement);
console.log(titleText);

// Close the browser
await browser.close();
})();
})();
Loading