File download with Playwright fails due copy

Hi, I’m trying to download file using playwright library but get stuck on error.

${dl_promise}        Promise To Wait For Download    ${TEMPDIR} 
Click    button[name='DownloadButton']
${file_obj}=         Wait For  ${dl_promise}

Result is error

Error: download.saveAs: EPERM: operation not permitted, copyfile 
'C:\Users\Raivo\AppData\Local\robocorp\temp\bb3cd54a34e55f3f\playwright-artifacts-sjJRyH\70c17940-4354-48b8-aa4e-a351d0d820c6' -> 
'C:\Users\Raivo\AppData\Local\robocorp\temp\bb3cd54a34e55f3f'

Any pointer on this? Also I’m using this template

Got it to work, seems now also filename is excepted. Or at least was needed on my case


4 Likes

Yes, the old Robot Framework Browser docs did not mention that the filename was required. Now that issue is resolved (Promise To Wait For Download keyword documentation issue · Issue #949 · MarketSquare/robotframework-browser · GitHub).

I used this syntax for handling the windows vs unix environments:

${dl_promise}    Promise To Wait For Download    ${CURDIR}${/}output${/}${FILENAME}

Where FILENAME was declared in the Variable section.

Regards,
Warren

Error: download.saveAs: canceled
getting this error in ${dl_promise}

According error download was canceled? If it big file you are downloading maybe its needed to increase timeouts.

ok, where I need to give the browser timeout. Promise To Wait For Download doesn’t have any timeout argument

You can change timeouts before the download for example and set it back later. Also if you can determine file url you could use Download keyword to get the file.