Created
March 29, 2022 11:09
-
-
Save Tallyb/773b438f8c51d1981b9ef47a6ce67902 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
await page.goto('your url') | |
await page.locator('username').fill('username'); | |
await page.locator('password').fill('123456'); | |
await page.locator('text="Submit").click(); | |
// use this to wait for something to show up that the page has completed loading | |
await page.locator('some locator').waitFor(); | |
// From your example it is not clear what is the selector logic | |
// this one will selector all a tags that has attribute resource | |
// it will return the attribute name on the element | |
// Tweak the logic to your needs. | |
const results = await page.$$eval(`a[resource]`, (div) => div.getAttribute('name') ); | |
await fs.writeFileSync('filename', results) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment