Created
May 21, 2020 11:54
-
-
Save dhAlcojor/e7ad4d9c4d3dad8f495578805a1abbf3 to your computer and use it in GitHub Desktop.
Revisions
-
dhAlcojor created this gist
May 21, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,21 @@ const playwright = require('playwright'); (async () => { for (const browserType of ['chromium', 'firefox', 'webkit']) { const browser = await playwright[browserType].launch(); try { const context = await browser.newContext(); const page = await context.newPage(); await page.goto('https://google.com'); await page.fill('input[name=q]', 'cheese'); await page.press('input[name=q]', 'Enter'); const firstResult = page.$('div#rso h3'); console.log(`${browserType}: ${firstResult.textContent()}`); } catch(error) { console.error(`Trying to run test on ${browserType}: ${error}`); } finally { await browser.close(); } } })();