Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multiple downloads seem to download last one only #21

Open
lau-a opened this issue Nov 3, 2017 · 1 comment
Open

multiple downloads seem to download last one only #21

lau-a opened this issue Nov 3, 2017 · 1 comment

Comments

@lau-a
Copy link

lau-a commented Nov 3, 2017

So I'm trying to download multiple files like this:

    nightmare.on('download', function(state, downloadItem){
        console.log('download', state, downloadItem);
        if(state == 'started'){
            nightmare.emit('download', 'continue', downloadItem);
        }
    });

    
    let test = nightmare
        .downloadManager()
        .goto(url, {Authorization: "Basic"})
        .wait("#summary-val")
        .evaluate( () => {
            document.querySelectorAll("#file_attachments li .attachment-thumb a").forEach( function(elem) {
                elem.click()
            })
        })
        .waitDownloadsComplete()
        .end()
        .then()
        .catch((error) => {
            console.error('download failed:', error);
        });

But what happens is that it only downloads the last file in the list. In the console.log in the nightmare.on all of the files are the last file's filename. Is this an issue or am I doing something wrong?

@rob-gordon
Copy link

Also having a difficult time looping over elements and downloading each. Would love to see a clearer example of this (w/o using vo)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants