0.7.3-wat-4497-cdf1cae13 • Published 4 months ago

@testring-dev/dwnld-collector-crx v0.7.3-wat-4497-cdf1cae13

Weekly downloads
-
License
MIT
Repository
-
Last release
4 months ago

@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',
}