Skip to content
This repository has been archived by the owner on May 28, 2022. It is now read-only.

add functionality to show more accomplishments #1

Merged
merged 2 commits into from
Jun 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/profile/seeMoreButtons.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
const logger = require('../logger')(__filename)
const showMoreAccomplishments = require('./showMoreAccomplishments')

const seeMoreButtons = [
{
id: 'SHOW_MORE_ABOUT',
Expand Down Expand Up @@ -36,7 +38,7 @@ const clickAll = async(page) => {
}
}

return
return await showMoreAccomplishments(page);
}

module.exports = { clickAll }
47 changes: 47 additions & 0 deletions src/profile/showMoreAccomplishments.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
const logger = require('../logger')(__filename)

const accomplishments = [
'courses',
'projects',
'languages',
'honors',
'patents',
'publications',
'organizations',
'test-scores'
]

const showAccomplishments = async (page) => {
for (let accomplishment of accomplishments) {
const selector = '.pv-accomplishments-block.' + accomplishment;;

try {
const elems = await page.$$(selector + ' button')
const elem = elems[0]
if (elem)
await elem.click()
else
continue
} catch (e) {
logger.warn(`couldn't click on ${accomplishment}, it's probably invisible`)
continue
}

while (true) {
try {
const elems = await page.$$(selector + ' button.pv-profile-section__see-more-inline')
const elem = elems[0];
if (elem)
await elem.click()
else
break;
} catch (e) {
break
}
}

}
return
}

module.exports = { showAccomplishments }