Wait for Sourceforge File to Download

We are building a robot as part of a patching process and are attempting to download latest updates of some files, many of which have Sourceforge options. We really just need to open the browser to the specific download file, wait for the download to finish, then close the browser. Since Sourceforge waits for 5 seconds to ensure users are not robots (ironic I know), is there a way to pause the closing of the browser for say 10 seconds or pause the closing until confirmation is received that the download was successful?

Hi! A quick experiment with Playwright seems to work:

*** Settings ***
Documentation     Download a file from SourceForge.
Library           OperatingSystem
Library           RPA.Browser.Playwright    timeout=60s

*** Variables ***
${PROJECT_URL}=    https://sourceforge.net/projects/keepass/
${DOWNLOAD_DIR}=    ${OUTPUT_DIR}
${DOWNLOAD_START_TEXT}=    Your download will start

*** Tasks ***
Download a file from SourceForge
    Open SourceForge project page
    Deny cookies
    Download and wait

*** Keywords ***
Open SourceForge project page
    New Context    acceptDownloads=True
    New Page    ${PROJECT_URL}

Deny cookies
    Click    "I DO NOT ACCEPT"

Download and wait
    ${download_promise}=    Promise To Wait For Download    ${DOWNLOAD_DIR}/myfile.zip
    Click    "Download"
    Wait For Elements State    text=${DOWNLOAD_START_TEXT}
    Wait For Elements State    text=${DOWNLOAD_START_TEXT}    hidden
    ${file_object}=    Wait For    ${download_promise}
    File Should Exist    ${file_object}[saveAs]

I used this conda.yaml for dependencies:

channels:
  - conda-forge
dependencies:
  - python=3.7.5
  - pip=20.1
  - nodejs=14.15.4
  - pip:
      - robotframework-browser==5.1.0
      - rpaframework==10.3.0
rccPostInstall:
  - rfbrowser init
1 Like

Am I missing a dependency or configuration somewhere? For whatever reason when the kernel is selected as robot framework, the environment is not recognizing any of the playwright keywords.

channels:
  # Define conda channels here. 
  - conda-forge

dependencies:
  # Define conda packages here. 
  # If available, always prefer the conda version of a package, installation will be faster and more efficient.
  # https://anaconda.org/search  
  - python=3.7.5
  - pip=20.1
  - pip:
    # Define pip packages here. 
    # https://pypi.org/
    - rpaframework==10.3.0 # https://rpaframework.org/releasenotes.html

Yes, you are missing some dependencies and an initialization command. Copy & paste the conda.yaml example from the message above. :slight_smile:

Note: The current Playwright dependencies are quite large, so it will take some time to update the environment.

1 Like

That worked! Thank you and yes, that did take a long time to update the dependencies!

1 Like