Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function olx_links() {
- return new Promise((resolve, reject) => {
- driver.get(olxUrl())
- .then(_ => driver.findElement(By.id('offers_table')))
- .then(e => e.findElements(By.className('wrap')))
- .then(e => {
- Promise.all(e.map(wrap => wrap.findElements(By.className('detailsLink')))).then(detailsLinks => {
- Promise.all(detailsLinks).then(detailsLinksObjs => {
- let dl = detailsLinks.flatMap(f => f)
- let links = dl.map(l => l.getAttribute("href"))
- Promise.all(links).then(
- lks => {
- resolve(lks.unique())
- }
- )
- })
- })
- })
- })
- }
- olx_links().then(console.log)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement