Web Dev Solutions

Catalin Mititiuc

aboutsummaryrefslogtreecommitdiff
blob: bf751a6efaa348c153566d0fce500bc886a32177 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import { Builder } from 'selenium-webdriver';
import chrome from 'selenium-webdriver/chrome.js';

console.log("Start the browser.")

let chromeOptions = new chrome.Options();
chromeOptions.addArguments('--headless', '--disable-gpu', '--no-sandbox');

let driver = new Builder()
    .forBrowser('chrome')
    .setChromeOptions(chromeOptions)
    .build();

console.log("Done!")

console.log("Open Google.")
await driver.get("https://google.com");
console.log("Done!")

const html = await driver.getPageSource();

driver.quit()