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

chromium is opening but not doing anything #873

Closed
ohadperry opened this issue Jul 10, 2024 · 20 comments
Closed

chromium is opening but not doing anything #873

ohadperry opened this issue Jul 10, 2024 · 20 comments

Comments

@ohadperry
Copy link

ohadperry commented Jul 10, 2024

Macbook Apple M2

what I'm seeing:
Screenshot at Jul 10 11-58-31

I don't think it's related to specific scraper since I've tried leumi also

full code

 const { getPuppeteerConfig } =  require('israeli-bank-scrapers-core');

// local chromium path
//Users/ohadperry/.nvm/versions/node/v20.9.0/lib/node_modules/download-chromium/.local-chromium/chromium-mac-499413/chrome-mac/Chromium.app/Contents/MacOS/Chromium
const chromiumVersion = getPuppeteerConfig().chromiumRevision;
const { CompanyTypes, createScraper } = require('israeli-bank-scrapers-core');

(async function() {
    try {
        // read documentation below for available options
        const options = {
            companyId: CompanyTypes.leumi,
            startDate: new Date('2024-07-07'),
            combineInstallments: false,
            showBrowser: true,
            executablePath: '/Users/ohadperry/.nvm/versions/node/v20.9.0/lib/node_modules/download-chromium/.local-chromium/chromium-mac-499413/chrome-mac/Chromium.app/Contents/MacOS/Chromium'
        };

        // read documentation below for information about credentials
        const credentials = {
            username: process.env.MIZRACHI_USERNAME,
            password: process.env.MIZRACHI_PASSWORD
        };

        const scraper = createScraper(options);
        const scrapeResult = await scraper.scrape(credentials);

        if (scrapeResult.success) {
            scrapeResult.accounts.forEach((account) => {
                console.log(`found ${account.txns.length} transactions for account number ${account.accountNumber}`);
                for (const txn of account.txns) {
                    console.log(`txn is ${JSON.stringify(txn)}`);
                }
            });
        }
        else {
            throw new Error(scrapeResult.errorType);
        }
    } catch(e) {
        console.error(`scraping failed for the following reason: ${e.message}`);
    }
})();

@ohadperry
Copy link
Author

plus if there is an example of github actions or aws cron as to how to run preiodically on the could without the localhost dependency it would be great.
I can investigate myself with a little help.
great project btw!!

@baruchiro
Copy link
Collaborator

I suggest waiting for #862 to be merged because it adds a huge upgrade to Pupetteer.

@baruchiro
Copy link
Collaborator

Please check with the latest release

@ohadperry
Copy link
Author

I did. it still stuck
image

my package.json

{
  "name": "bankscraper",
  "version": "1.0.0",
  "main": "index.js",
  "author": "[email protected]",
  "license": "MIT",
  "dependencies": {
    "download-chromium": "^3.0.0",
    "israeli-bank-scrapers-core": "^5.0.1"
  }
}

@ohadperry
Copy link
Author

also tried adding "israeli-bank-scrapers": "^5.0.1" same result.
maybe it's the chromiumVersion. it changed but download-chromium versionNum doesn't download a new version of it

@ohadperry
Copy link
Author

@baruchiro is there a github action yml you know works for this library? I think it will be the simplest solution

@baruchiro
Copy link
Collaborator

It sounds like a good idea, I don't remember if I already thought about that.

@ohadperry
Copy link
Author

ohadperry commented Jul 11, 2024

@ohadperry
Copy link
Author

ohadperry commented Jul 11, 2024

tried this and got scraping failed for the following reason: GENERIC

scrapeResult: {"success":false,"errorType":"GENERIC","errorMessage":"Error: failed to find element matching selector \"a[href*=\"/osh/legacy/legacy-Osh-p420\"]\""}
name: Bllink Auto detect failed bank charges
on:
  pull_request:
    branches: [ production  ]
jobs:
  markeFailedBankCharges:
    name: Install Dependencies
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node-version: [ 20.x ]

    steps:
      - uses: actions/checkout@v3
      - name: Install Dependencies
        uses: actions/setup-node@v2
        env:
          PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: "true"
        with:
          args: install

      - name: Install bllink dependencies
        run: yarn install --dev


      - name: Failed Bank Charges
#        uses: mujo-code/[email protected]
#        with:
#          args: yarn run autoBankCharge
        run: yarn autoBankCharge
        env:
          CI: "true"
          MIZRACHI_USERNAME: ${{ secrets.MIZRACHI_USERNAME }}
          MIZRACHI_PASSWORD: ${{ secrets.MIZRACHI_PASSWORD }}


@baruchiro
Copy link
Collaborator

The project's tests run headlessly, maybe you can configure them and run the tests and you will get the output.

@ohadperry
Copy link
Author

@baruchiro not sure what you mean by that.
is it working for other users?
I tried running it from a docker and got this error (not finding relevant elements)

349413236-2b9f602e-e352-4d47-b9c7-e6d5d1711917

daniel-hauser/moneyman#302

@baruchiro
Copy link
Collaborator

I'm talking about the Github Actions. It is not my fault you joined two subjects in one issue 😂

@ohadperry
Copy link
Author

@baruchiro either way it's not scraping due to this error Error: failed to find element matching selector "a[href*="/osh/legacy/legacy-Osh-p420"]". can you help?

@ohadperry
Copy link
Author

I can close this issue and open another one if that helps

@baruchiro
Copy link
Collaborator

@baruchiro either way it's not scraping due to this error Error: failed to find element matching selector "a[href*="/osh/legacy/legacy-Osh-p420"]". can you help?

Make sure you're using the latest israeli-bank-scrapers

@ohadperry
Copy link
Author

@baruchiro I upgraded to 5.0.1, rebuilt the docker image and re ran it. still the same error.
is there anything else I can do to help with the debugging here?

@ohadperry
Copy link
Author

I also added a leumi account to check the issue is limited to mizrachi

image

@ohadperry
Copy link
Author

אין לינק לדיסקורד.
בכל מקרה, זה לא נפתר כי שידרגתי לגרסה 5.0.1.
האם אני צריך להעביר משהו מיוחד בoptions ?

@baruchiro
Copy link
Collaborator

OK let's pause.

I need to understand what exactly we are talking about. And yes, if you can open an issue for each problem it will be helpful.

  • Chromium is opening but not doing anything?
  • Mizrahi is failing?
  • Run on Github Actions?

(I deleted the Discord message because I was confused between this project and brafdlog/caspion...)

@ohadperry
Copy link
Author

closing this one and opened a new one
#877

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants