Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated selectors to fix broken contact info #171

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
10 changes: 5 additions & 5 deletions src/profile/contactInfo.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
const logger = require('../logger')(__filename)
const scrapSection = require('../scrapSection')

const SEE_MORE_SELECTOR = 'a[data-control-name=contact_see_more]'
const SEE_MORE_SELECTOR = 'a[href*="contact-info]'
const CLOSE_MODAL_SELECTOR = '.artdeco-modal__dismiss';

const template = {
selector: '.pv-contact-info__contact-type',
fields: {
type: 'header',
type: 'h3',
values: {
selector: '.pv-contact-info__ci-container',
isMultipleFields: true
Expand All @@ -18,7 +18,7 @@ const template = {
isMultipleFields: true
}
}
}
}
const getContactInfo = async(page) => {
await page.waitFor(SEE_MORE_SELECTOR, { timeout: 2000 })
.catch(() => {
Expand All @@ -34,15 +34,15 @@ const getContactInfo = async(page) => {
.catch(() => {
logger.warn('contact info was not found')
})

const contactInfo = await scrapSection(page, template)
const closeButton = await page.$(CLOSE_MODAL_SELECTOR)
if(closeButton)
await closeButton.click()

return contactInfo
}

}

module.exports = getContactInfo