node.js has bindings to one of the most popular automated testing tool for web pages, selenium. To install:
npm install selenium-webdriver --save
Download the Chrome Driver: https://chromedriver.storage.googleapis.com/index.html?path=2.41/
Download the standalone Selenium Server: http://selenium-release.storage.googleapis.com/3.9/selenium-server-standalone-3.9.1.jar
Start the selenium server:
java -jar selenium-server-standalone-3.9.1.jarSample selenium session:
let webdriver = require("selenium-webdriver");
async function main() {
let driver = await new webdriver.Builder().forBrowser("chrome").build();
try {
await driver.get("https://www.google.com/about/");
let mission = await driver.findElement(webdriver.By.className("home-hero-copy center")).getText();
console.log(mission)
} catch (e) {
console.log(e);
}
}
main();