Where to find downloaded files while browser testing in AWS device farm

0

I am testing a web-based application using Chrome browser on an AWS device farm. My automation framework is based on Selenium and Python. The testing includes downloading CSV files from the UI, I need to verify the content of the files. I tried using location:

`download_dir = r"C:\Users\testnode" if dvf else os.path.expanduser('~') + '/Downloads/'

However, it returned: E FileNotFoundError: [WinError 3] The system cannot find the path specified: 'C:\\Users\\testnode'

Where are those downloaded files via Chrome saved? And how can I access them?

asked a month ago39 views
1 Answer
0

When testing web applications using AWS Device Farm's desktop browser testing feature, the downloaded files are not saved in the typical local directories you might expect on a personal computer. Instead, AWS Device Farm manages the test environment differently.

For browser-based tests in Device Farm, downloaded files are typically stored in a temporary location within the test environment. However, these files are not directly accessible through standard file paths like "C:\Users\testnode" or "/home/user/Downloads".

To access and verify the content of downloaded files in your Device Farm tests, you should consider the following approaches:

  1. Use the browser's download directory: Instead of specifying a local path, you can set the download directory for Chrome using Selenium WebDriver options. For example:

    from selenium import webdriver
    from selenium.webdriver.chrome.options import Options
    
    chrome_options = Options()
    chrome_options.add_experimental_option("prefs", {
        "download.default_directory": "/tmp",
        "download.prompt_for_download": False,
    })
    driver = webdriver.Chrome(options=chrome_options)

    This sets the download directory to "/tmp", which is typically accessible in most test environments.

  2. Use Device Farm artifacts: After your test run completes, Device Farm collects various artifacts, including any files generated during the test. You can access these artifacts after the test run is complete. The exact method to retrieve these artifacts depends on how you're running your tests (e.g., through the AWS console or using the AWS CLI).

  3. Implement a custom solution: If you need to verify the file content during the test run, you might need to implement a custom solution. For example, you could use JavaScript execution in the browser to read the file content immediately after download, or use a proxy server to intercept and verify downloads.

Remember that the Device Farm test environment is different from a typical local development environment, so you may need to adjust your test scripts accordingly. If you're having trouble accessing downloaded files, you might want to explore Device Farm's documentation on artifacts and custom test environments for more specific guidance on handling files in your test scenarios.
Sources
Device Farm desktop browser testing - Device Farm desktop browser testing
Downloading artifacts in Device Farm - AWS Device Farm

Downloading session video or logs

profile picture
answered a month ago
AWS
SUPPORT ENGINEER
reviewed a month ago
AWS
SUPPORT ENGINEER
revised a month ago
AWS
SUPPORT ENGINEER
revised a month ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions