-
Notifications
You must be signed in to change notification settings - Fork 165
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
fix(beinleumi): account with no balance (inactive) #893
Conversation
@baruchiro could you please review 🙏 |
src/scrapers/base-beinleumi-group.ts
Outdated
const balanceElement = await page.$(CURRENT_BALANCE); | ||
if (!balanceElement) { | ||
return undefined; | ||
} | ||
const balanceStr = await page.$eval(CURRENT_BALANCE, (option) => { | ||
return (option as HTMLElement).innerText; | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know your JS Scraping experience, but do you think once you have a reference to the balanceElement
, get its innerText
(instead of using eval
again on the same selector)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have no experience at all with either JS or scraping 🙃
I looked at the Puppeteer docs now, and it looks like we can do balanceElement.evaluate
. I tested this and it works.
This is still another evaluation, though. But I guess it's slightly more efficient as it shouldn't be searching for the element in the entire page? Not sure tbh.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You see, it is not so important, and I don't think efficiency is critical here.
But it is less confusing, and the code is more straightforward—find an element, and if it exists, take its innerText.
@whatuserever Can I register you as a tester for Beinleumi? #830 |
🎉 This PR is included in version 5.2.3 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Sure |
In Beinleumi, inactive accounts expectedly do no have a balance. See the comparison below between an active and inactive accounts.
This PR fixes #892 by making the
balance
optional for BeinleumiActive
Inactive
Test
Ran the scraper and printed
scrapeResult.accounts
Before
After