zbeucler

Untitled

Jul 20th, 2020
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const puppeteer = require('puppeteer');
  2.  
  3. const clipboard = require('clipboardy');
  4. //const delay = require('delay');
  5.  
  6.  
  7.  
  8. var userClipboard = clipboard.readSync();
  9. //console.log(clipboard.readSync()); // get clipboard contents
  10.  
  11.  
  12.  
  13.  
  14. (async () => {
  15.   const browser = await puppeteer.launch({ headless: false });
  16.   const page = await browser.newPage();
  17.   await page.goto('https://accounts.google.com/signin/v2/identifier?continue=https%3A%2F%2Fmail.google.com%2Fmail%2F&service=mail&sacu=1&rip=1&flowName=GlifWebSignIn&flowEntry=ServiceLogin');
  18.  
  19.   // enter email username
  20.   await page.type('#identifierId', "xxxxxxxxx@gmail.com");
  21.   await page.type('#identifierId',String.fromCharCode(13));
  22.  
  23.   await new Promise(resolve => setTimeout(resolve, 1500));
  24.    
  25.  
  26.   // enter email password
  27.  
  28.   await page.type('[autocomplete]', 'xxxxxxxxx', {delay: 100});
  29.   await page.type('[autocomplete]',String.fromCharCode(13));
  30.  
  31.   await new Promise(resolve => setTimeout(resolve, 5000));
  32.  
  33.   const emailPage = await browser.newPage();
  34.   await emailPage.goto('https://mail.google.com/mail/u/0/#inbox/xxxxxxxxxxxxxxxxxxxxx');
  35.  
  36.   //await new Promise(resolve => setTimeout(resolve, 5000));
  37.   await emailPage.waitForNavigation({ waitUntil: 'networkidle2' });
  38.  
  39.  
  40.   //await emailPage.click('#\:2r');
  41.  
  42.  
  43.  
  44.   //await emailPage.click('[id=:1w]');
  45.   //await emailPage.click('[jslog]');
  46.  
  47.   //await emailPage.click('#\:2r');
  48.  
  49.  
  50.   await emailPage.$x('/#\:2r');
  51.   const ele = await emailPage.$x('/#\:2r');
  52.   console.log(ele);
  53.   await ele[0].click();
  54.  
  55.  
  56.   //await emailPage.$x('/html/body/div[24]/div[1]');
  57.   //const ele = await emailPage.$x('/html/body/div[24]/div[1]');
  58.   //console.log(ele);
  59.   //await ele[0].click();
  60.  
  61.  
  62.   //page.mouse.click(x, y)
  63.   //await emailPage.click('span#:5u.ams.bkH');
  64.  
  65.   console.log(1);
  66.  
  67.  
  68.   await new Promise(resolve => setTimeout(resolve, 5000));
  69.  
  70.  
  71.  
  72.  
  73.   //await page.goto('https://pptr.dev');
  74.  
  75.  
  76.   await browser.close();
  77.   console.log("done");
  78. })();
Add Comment
Please, Sign In to add comment