chore(examples): update search example (#1181)

The search bar was not fully loaded and therefore "puppeteer" could not be entered into the submit field.

This patch starts waiting for the input element to be rendered to ensure this
element is loaded before attempting to populate it.
This commit is contained in:
Andrew Apicello 2017-10-27 05:10:35 -04:00 committed by Andrey Lushnikov
parent 5ffbd0d221
commit f9b017efaa

View File

@ -23,6 +23,8 @@ const puppeteer = require('puppeteer');
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto('https://google.com', {waitUntil: 'networkidle2'});
await page.waitFor('input[name=q]');
// Type our query into the search bar
await page.type('input[name=q]', 'puppeteer');