Created
February 2, 2021 18:25
-
-
Save pavelfeldman/290c238e3e025eaebcd8f3816b7169ba to your computer and use it in GitHub Desktop.
This file contains 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 characters
const { chromium } = require('.'); | |
(async () => { | |
const browser = await chromium.launch({ | |
headless: false, | |
}); | |
const context = await browser.newContext({ | |
// _traceDir: '.trace' | |
recordVideo: { | |
dir: '.video', | |
// size: { width: 800, height: 600 } | |
} | |
}); | |
// Open new page | |
const page = await context.newPage(); | |
// Go to https://github.com/microsoft | |
await page.goto('https://github.com/microsoft'); | |
await page.waitForTimeout('1000'); | |
// Click input[aria-label="Find a repository…"] | |
await page.click('input[aria-label="Find a repository…"]'); | |
// Fill input[aria-label="Find a repository…"] | |
await Promise.all([ | |
page.waitForNavigation(/*{ url: 'https://github.com/microsoft?q=playwright&type=&language=' }*/), | |
page.type('input[aria-label="Find a repository…"]', 'playwright', { delay: 500 }) | |
]); | |
// Click //a[normalize-space(.)='playwright'] | |
await page.click('//a[normalize-space(.)=\'playwright\']'); | |
// assert.equal(page.url(), 'https://github.com/microsoft/playwright'); | |
await page.waitForTimeout('2000'); | |
// Click text="Issues" | |
await Promise.all([ | |
page.waitForNavigation(/*{ url: 'https://github.com/microsoft/playwright/issues' }*/), | |
page.click('text="Issues"') | |
]); | |
await page.waitForTimeout('2000'); | |
// Click text="triaging" | |
await Promise.all([ | |
page.waitForNavigation(/*{ url: 'https://github.com/microsoft/playwright/issues?q=is:issue+is:open+label:triaging' }*/), | |
page.click('text="triaging"') | |
]); | |
await page.waitForTimeout('2000'); | |
// --------------------- | |
console.time('VIDEO SAVE'); | |
await context.close(); | |
console.timeEnd('VIDEO SAVE'); | |
await browser.close(); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment