transitive-bullshit / puppeteer-email

Email automation driven by headless chrome.
164 stars 22 forks source link

GMAIL - Unable to open the latest email and click on one of the link #11

Open samathan opened 4 years ago

samathan commented 4 years ago

Hi,

I am trying to open the latest email in Gmail and click on one of the click. But I am unable to. Here are steps using Puppeteer ,

  1. Login into GMAIL, ---- Successful 2.Search for the "Unread email with the text"- Successful
  2. Now using xPath trying to click on the latest email but failing, Below is the code await page.waitForXPath('//[@class="zA zE"]'); const [emails] = await page.$x('//[@class="zA zE"]'); if(emails) { await Promise.all([ await page.waitForNavigation(), emails.click() ]) } it says TypeError: Cannot read property 'click' of undefined

Could anyone please help me with this.

graphee-gabriel commented 4 years ago

Hello @samathan , quick question, how did you manage to login to gmail, last time i checked google blocks automated browsers from login in to their services, so i'm really curious :-) !

samathan commented 4 years ago

Hi @graphee-gabriel, you are right, even I have seen 2 types of blocking issues with 2 different gmail accounts. With one gmail account its captcha, but just deleting the node modules and did npm install again resolved the captcha issue.

With another gmail account it says "You are trying to sign in from a browser or app that doesn't allow us to keep your account secure". I couldn't resolve this issue.

graphee-gabriel commented 4 years ago

Yes exactly mine is the second one. My guess is that you can't use google services through browser automation, as they want you to use their APIs. Therefore I'll dig in what i can do with the available APIs. A heavier alternative if you really want to do UI automation is to use global screen reader/automator services such as UIPath.