@airporting/scrap-tools v1.0.6
scrap-tools
Usage
const browser = await puppeteer.launch({...});
const context = await browser.createIncognitoBrowserContext();
const page = await context.newPage();
const {
screenshot,
click,
fill,
wait
} = require('@airporting/scrap-tools')(page);
Typings
Typings of this module are available at root of this package.
Methods
When term selector
is used above, it refers to well known CSS selectors : https://developer.mozilla.org/fr/docs/Web/CSS/CSS_Selectors
Click
await click('selector');
Will wait for selector and will try to click on it.
Fill
await fill('selector', value_as_string);
Will wait for selector and will try to fill with value.
Screenshot
await screenshot('name');
Will take a screenshot of current page and will name it belongs to name argument. Will store it into root folder screenshot. You need to create it manually before. If not exists, will crash your script.
Screenshot
await screenshot('name');
Will take a screenshot of current page and will name it belongs to name argument. Will store it into root folder screenshot. You need to create it manually before. If not exists, will crash your script.
Wait
await wait([timeout]);
Will just wait for time passed as argument (optionnal). Default to 2 000 ms.