JSFiddle - React, Tailwind, and code Playground

by Chris

JavaScript

import puppeteer from "puppeteer";

(async () => {
  // Create a new browser instance.
  const browser = await puppeteer.launch();

  // Navigate to a website.
  const page = await browser.newPage();
  await page.goto("https://www.google.com");

  // Find an element on the page.
  const searchBar = await page.findElement(by.name("q"));

  // Type something into the search bar.
  await searchBar.type("Bard");

  // Click the search button.
  await searchBar.click();

  // Wait for the page to load.
  await page.waitForNavigation();

  // Check the title of the page.
  const title = await page.title();
  console.log(title);

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