@testring-dev/dwnld-collector-crx
v0.6.11-xtap-8866-94541bc94
Published
## Installation
Downloads
4
Readme
@testring-dev/dwnld-collector-crx
Installation
npm install @testring-dev/dwnld-collector-crx
How to use
accessing chrome internal page like chrome://downloads is not allowed in headless mode, as a result, checking download results becomes unavaiable. once this chrome extension installed. chrome download items can be accessed within page via localStorage, like this:
const downloadsJSONStr = await browser.execute(() => {
return localStorage.getItem('_DOWNLOADS_');
})
// the result is already sort ASC by startTime
const downloads = JSON.parse(downloadsJSONStr);
downloads is an array of download items, each item has following properties:
{
fileName: 'example.pdf',
filePath: '/Users/username/Downloads/example.pdf',
state: 'complete',
startTime: '2021-01-01T00:00:00.000Z',
state: 'complete',
}