Chapter 8: draft code samples

This commit is contained in:
Beth Griggs
2020-07-01 03:17:32 +01:00
parent b54b35efb5
commit d918785e10
23 changed files with 5804 additions and 487 deletions
+16
View File
@@ -0,0 +1,16 @@
const assert = require("assert");
const puppeteer = require("puppeteer");
async function runTest() {
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto("https://example.com");
const title = await page.$eval("h1", (el) => el.innerText);
console.log("Title value:", title);
assert.equal(title, "Example Domain");
browser.close();
}
runTest();