diff --git a/README.md b/README.md index 8ae61f5..51366e0 100644 --- a/README.md +++ b/README.md @@ -206,4 +206,4 @@ curl -H "X-With-Generated-Alt: true" https://r.jina.ai/https://en.m.wikipedia.or ## License -[Apache-2.0](./LICENSE) +[Apache-2.0](./LICENSE) \ No newline at end of file diff --git a/backend/functions/src/services/puppeteer.ts b/backend/functions/src/services/puppeteer.ts index 05921e5..dd4416b 100644 --- a/backend/functions/src/services/puppeteer.ts +++ b/backend/functions/src/services/puppeteer.ts @@ -591,8 +591,30 @@ document.addEventListener('load', handlePageLoad); ); } }); + + try { + console.log('Waiting for Sign Out link'); + await page.waitForSelector('a[href="/signout"]', { timeout: 10000 }); + console.log('Sign Out link found'); + } catch (error) { + this.logger.warn(`Timed out waiting for Sign Out link: ${error}`); + } + + try { + console.log('Clicking on #getOwnerDetails'); + await page.click('#getOwnerDetails'); + console.log('Clicked on #getOwnerDetails'); + + // console.log('Waiting for Phone No span to appear'); + // await page.waitForSelector('span:contains("Phone No :")', { timeout: 10000 }); + // console.log('Phone No span appeared'); + } catch (error) { + this.logger.warn(`Error during click or wait operation: ${error}`); + } + let waitForPromise: Promise | undefined; if (options?.waitForSelector) { + console.log('Waiting for selector', options.waitForSelector); const t0 = Date.now(); waitForPromise = nextSnapshotDeferred.promise.then(() => { const t1 = Date.now(); diff --git a/package.json b/package.json index 7424e52..1b9eab8 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,8 @@ "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", - "start": "ts-node src/server.ts" + "start": "cd backend/functions && npx nodemon --watch ./src --exec \"npm run build && node build/server.js\"", + "build": "tsc" }, "author": "", "license": "ISC", @@ -13,7 +14,8 @@ "firebase-tools": "^12.4.2", "typescript": "^5.1.6", "@types/express": "^4.17.17", - "ts-node": "^10.9.1" + "ts-node": "^10.9.1", + "nodemon": "^2.0.22" }, "dependencies": { "express": "^4.17.1",