TestingBot Blog

TestingBot provides a cloud of browsers and devices, ready to run your Automated, Live and Visual tests.

< Back to Blog Overview

Uploading with WebDriver

2015-12-11

Since a lot of websites have upload functionality, it's important to know that this can be tested via Selenium.

Uploading a file during a test

With Selenium WebDriver it's possible to upload a file from your own computer. In your test, you indicate which file you would like to upload, after which WebDriver will send the file from your computer, base64-encoded, to the Selenium node.


When you want to upload a file during your test via the TestingBot.com selenium grid, you can use the LocalFileDetector feature in WebDriver to upload a file from the machine running your test to our test VMs. Since we guarantee a pristine virtual machine for every test, you can be sure that after every test your uploaded files are destroyed.


An example in Java:

Uploading a file before starting a test

In some cases, you might want to make sure a file is already uploaded on our test VMs before your test starts. With TestingBot, you can specify the location (URL) of the file and the path where you want the file to be placed on our VMs. You can put these details in your desired capabilities (the options you send at the start of the test). TestingBot will then first download the file and place it in the location you want.


The way to do this is by specifying in your desired capabilities:

This will download the file from mywebsite.com/myfile.ext and place it in C:\myfile.ext During your test, you can use the C:\myfile.ext file to test your upload.


The same functionality is also available on our MAC and Linux VMs, where you can store them in the "/tmp" folder for example.


You can find more options for your tests on our test options page.

< Back to Blog Overview

Sign up for a Free Trial

Start testing your apps with TestingBot.

No credit card required.