Created
November 13, 2018 13:53
-
-
Save RoyiNamir/8ef0d85bf23eb9b61547d60446379785 to your computer and use it in GitHub Desktop.
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 characters
const getElementsAsync = (async (selector: string, section: ElementHandle | null, propertyName: string, page) => | |
{ | |
let cubes: ElementHandle[] = []; | |
if (section) | |
{ | |
cubes = await section.$$(selector); | |
} | |
else | |
{ | |
cubes = await page.$$(selector); | |
} | |
if (propertyName) | |
{ | |
return await Promise.all(cubes.map(a=>getPropAsync(a,propertyName))); | |
} | |
else | |
{ | |
return cubes; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment