Commit 5d51122d authored by Tomáš Hübelbauer's avatar Tomáš Hübelbauer

Upgrade Puppeteer and implement listing first page of messages

parent 4d8bf7cc
......@@ -9,7 +9,7 @@
"start": "nodemon"
},
"dependencies": {
"puppeteer": "^1.2.0"
"puppeteer": "^1.3.0"
},
"devDependencies": {
"@types/puppeteer": "^1.2.1",
......
import * as puppeteer from 'puppeteer';
import secrets from './secrets';
// TODO: Wait for https://github.com/GoogleChrome/puppeteer/pull/2324 in Puppeteer 1.3.0
void async function() {
const browser = await puppeteer.launch({ headless: false });
const page = (await browser.pages())[0];
await page.goto('https://mojedatovaschranka.cz');
await page.type('#Ecom_User_ID', secrets.userName);
await page.type('#Ecom_Password', secrets.accessKey);
const infoDiv = await page.waitForSelector('.home-confirmation-info-notice');
const enterA = await infoDiv.$('.large button');
const enterA = await page.waitForSelector('#main > div.confirmation.pop-up > div.content > div.quadwide.col.t-c > p > a');
await enterA.click();
console.log('waitForSelector');
const messagesTable = await page.waitForSelector('table.messages');
for (const lineTr of await messagesTable.$$('tr')) {
const textTd = await lineTr.$('td.text');
const senderTd = await lineTr.$('td.sender');
const text = await page.evaluate((textTd: HTMLTableCellElement) => textTd.textContent, textTd);
const sender = await page.evaluate((senderTd: HTMLTableCellElement) => senderTd.textContent, senderTd);
console.log(`${sender}: ${text}`);
}
}()
# Upgrade to Puppeteer 1.3.0
[*Introduce `Page.setBypassCSP`* pull request](https://github.com/GoogleChrome/puppeteer/pull/2324)
# Detect password change request page
Change the password on my behalf and let me know the new one.
# Implement paging
# Notify about new messages
......@@ -1354,9 +1354,9 @@ punycode@^1.4.1:
version "1.4.1"
resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e"
puppeteer@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/puppeteer/-/puppeteer-1.2.0.tgz#6a8a1c618af073dfcf6fc7c7e3c12e54129ffa98"
puppeteer@^1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/puppeteer/-/puppeteer-1.3.0.tgz#f571c5f27153ca164a8188e6328ce2e4946878f3"
dependencies:
debug "^2.6.8"
extract-zip "^1.6.5"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment