Learn how to test the file download functionality using Automate TurboScale.
BrowserStack enhances your selenium testing suite by offering features to streamline file download interactions within web applications. These features are especially useful when testing scenarios like invoice generation, PDF downloads, and other file-centric workflows.
This feature is supported only for tests running with the Selenium framework.
Download files on Browserstack remote instances
To download files on BrowserStack’s remote instances, integrate the custom browserstack_executor script into your Automate TurboScale sessions. The following sample code illustrates its use in selenium:
importorg.openqa.selenium.By;importorg.openqa.selenium.Platform;importorg.openqa.selenium.WebDriver;importorg.openqa.selenium.WebElement;importorg.openqa.selenium.firefox.FirefoxProfile;importorg.openqa.selenium.firefox.FirefoxDriver;importorg.openqa.selenium.remote.DesiredCapabilities;importorg.openqa.selenium.remote.RemoteWebDriver;importjava.net.URL;publicclassJavaSample{publicstaticfinalString BROWSERSTACK_USERNAME ="YOUR_USERNAME";publicstaticfinalString BROWSERSTACK_ACCESS_KEY ="YOUR_ACCESS_KEY";publicstaticfinalString URL ="https://"+ BROWSERSTACK_USERNAME +":"+ BROWSERSTACK_ACCESS_KEY +"@hub-cloud.browserstack-ats.com/wd/hub";publicstaticvoidmain(String[] args)throwsException{FirefoxProfile profile =newFirefoxProfile();
profile.setPreference("browser.download.folderList",1);
profile.setPreference("browser.download.manager.showWhenStarting",false);
profile.setPreference("browser.download.manager.focusWhenStarting",false);
profile.setPreference("browser.download.useDownloadDir",true);
profile.setPreference("browser.helperApps.alwaysAsk.force",false);
profile.setPreference("browser.download.manager.alertOnEXEOpen",false);
profile.setPreference("browser.download.manager.closeWhenDone",true);
profile.setPreference("browser.download.manager.showAlertOnComplete",false);
profile.setPreference("browser.download.manager.useWindow",false);// You will need to find the content-type of your app and set it here.
profile.setPreference("browser.helperApps.neverAsk.saveToDisk","application/octet-stream");DesiredCapabilities capabilities =newDesiredCapabilities();
capabilities.setCapability("browserName","Firefox");
capabilities.setCapability("browserVersion","latest");HashMap<String,Object> browserstackOptions =newHashMap<String,Object>();
browserstackOptions.put("os","Windows");
browserstackOptions.put("osVersion","10");
capabilities.setCapability("bstack:options", browserstackOptions);WebDriver driver =newRemoteWebDriver(newURL(URL), caps);JavascriptExecutor jse =(JavascriptExecutor) driver;
driver.get("https://www.browserstack.com/test-on-the-right-mobile-devices");Thread.sleep(2000);
driver.findElement(By.id("accept-cookie-notification")).click();// Find element by class name and store in variable "Element"WebElementElement= driver.findElement(By.className("icon-csv"));// This will scroll the page till the element is found
jse.executeScript("arguments[0].scrollIntoView();",Element);
jse.executeScript("window.scrollBy(0,-100)");Thread.sleep(1000);// Click on the element to download the fileElement.click();Thread.sleep(2000);
driver.quit();}}
const{
Builder,
By,
Key,
until
}=require('selenium-webdriver');const fs =require("fs");const webdriver =require('selenium-webdriver');const bb =require('bluebird');var sleep =require('sleep');var FirefoxProfile =require('firefox-profile');var profile =newFirefoxProfile();
profile.setPreference('browser.download.folderList',1);
profile.setPreference('browser.download.manager.showWhenStarting',false);
profile.setPreference('browser.download.manager.focusWhenStarting',false);
profile.setPreference('browser.download.useDownloadDir',true);
profile.setPreference('browser.helperApps.alwaysAsk.force',false);
profile.setPreference('browser.download.manager.alertOnEXEOpen',false);
profile.setPreference('browser.download.manager.closeWhenDone',true);
profile.setPreference('browser.download.manager.showAlertOnComplete',false);
profile.setPreference('browser.download.manager.useWindow',false);// You will need the content-type of your app from developer tools on your browser and set it here. We are downloading a csv file.
profile.setPreference('browser.helperApps.neverAsk.saveToDisk','application/octet-stream');
profile.updatePreferences();
profile.encode((err, encoded)=>{var capabilities ={'bstack:options':{"os":"Windows","osVersion":"10","userName":"YOUR_USERNAME","accessKey":"YOUR_ACCESS_KEY",},"browserName":"Firefox","browserVersion":"latest",}var driver =newwebdriver.Builder().usingServer('https://hub-ft.browserstack.com/wd/hub').withCapabilities(capabilities).build();// Navigate to the link
driver.get('https://www.browserstack.com/test-on-the-right-mobile-devices').then(function(){// Find element by class name and store in variable "element"
driver.findElement(By.className('icon-csv')).then(function(element){// This will scroll the page till the element is found
driver.executeScript('arguments[0].scrollIntoView();', element).then(function(){
driver.executeScript('window.scrollBy(0,-200)').then(function(){// Accept the cookie popup
driver.findElement(By.id("accept-cookie-notification")).click().then(function(){// Click on the element to download the file
element.click().then(function(){
bb.delay(5000).then(function(){
driver.quit();});});});});});});});});
// Applies to selenium W3C protocol versionsusingSystem.Collections.Generic;usingSystem.Threading;usingOpenQA.selenium.Firefox;usingOpenQA.selenium.Remote;usingOpenQA.selenium;usingSystem.IO;usingSystem;usingSystem.Text;namespaceseleniumTest{classProgram{publicstaticvoidMain(string[] args){FirefoxProfile firefoxProfile =newFirefoxProfile();
firefoxProfile.SetPreference("browser.download.showWhenStarting",false);
firefoxProfile.SetPreference("browser.download.folderList",1);
firefoxProfile.SetPreference("browser.download.manager.focusWhenStarting",false);
firefoxProfile.SetPreference("browser.download.useDownloadDir",true);
firefoxProfile.SetPreference("browser.helperApps.alwaysAsk.force",false);
firefoxProfile.SetPreference("browser.download.manager.alertOnEXEOpen",false);
firefoxProfile.SetPreference("browser.download.manager.closeWhenDone",true);
firefoxProfile.SetPreference("browser.download.manager.showAlertOnComplete",false);
firefoxProfile.SetPreference("browser.download.manager.useWindow",false);
firefoxProfile.SetPreference("browser.helperApps.neverAsk.saveToDisk","application/octet-stream");FirefoxOptions capabilities =newFirefoxOptions();
capabilities.BrowserVersion ="latest";Dictionary<string,object> browserstackOptions =newDictionary<string,object>();
browserstackOptions.Add("os","Windows");
browserstackOptions.Add("osVersion","10");
browserstackOptions.Add("buildName","selenium C# Firefox Profile");
browserstackOptions.Add("userName","YOUR_USERNAME");
browserstackOptions.Add("accessKey","YOUR_ACCESS_KEY");
browserstackOptions.Add("browserName","Firefox");
capabilities.AddAdditionalOption("bstack:options", browserstackOptions);
capabilities.Profile = firefoxProfile;RemoteWebDriver driver =newRemoteWebDriver(newUri("https://hub-ft.browserstack.com/wd/hub"), capabilities
);// Navigate to the link
driver.Navigate().GoToUrl("https://www.browserstack.com/test-on-the-right-mobile-devices");IJavaScriptExecutor jse =(IJavaScriptExecutor)driver;
Thread.Sleep(2000);// This will scroll the page till the element is found
driver.ExecuteScript("arguments[0].scrollIntoView();", driver.FindElementByClassName("icon-csv"));
driver.ExecuteScript("window.scrollBy(0,-100)");
Thread.Sleep(2000);// Find element by class name and then click"
driver.FindElementByClassName("icon-csv").Click();
Thread.Sleep(1000);
driver.ExecuteScript("browserstack_executor: {\"action\": \"fileExists\"}");
driver.ExecuteScript("browserstack_executor: {\"action\": \"getFileProperties\"}");
driver.Quit();}}}
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
import time
profile = webdriver.FirefoxProfile()
profile.set_preference('browser.download.folderList',1)
profile.set_preference('browser.download.manager.showWhenStarting',False)
profile.set_preference('browser.download.manager.focusWhenStarting',False)
profile.set_preference('browser.download.useDownloadDir',True)
profile.set_preference('browser.helperApps.alwaysAsk.force',False)
profile.set_preference('browser.download.manager.alertOnEXEOpen',False)
profile.set_preference('browser.download.manager.closeWhenDone',True)
profile.set_preference('browser.download.manager.showAlertOnComplete',False)
profile.set_preference('browser.download.manager.useWindow',False)# You will need to find the content-type of your app and set it here. We are downloading a gzip file.
profile.set_preference('browser.helperApps.neverAsk.saveToDisk','application/octet-stream')
profile.update_preferences()
desired_cap ={'bstack:options':{"os":"Windows","osVersion":"10",},"browserName":"Firefox","browserVersion":"latest",}
options.set_capability('bstack:options', desired_cap)
driver = webdriver.Remote(
command_executor='https://hub-ft.browserstack.com/wd/hub',
options=options)# Navigate to the link
driver.get("https://www.browserstack.com/test-on-the-right-mobile-devices")# Accept the cookie popup
test=driver.find_element_by_id("accept-cookie-notification").click()
time.sleep(2)# Find element by class name and store in variable "element"
element = driver.find_element_by_class_name("icon-csv")
driver.execute_script("arguments[0].scrollIntoView();", element)
driver.execute_script("window.scrollBy(0,-100)")
time.sleep(2)# Click on the element to download the file
clicked = element.click()
time.sleep(2)
driver.quit()
require'rubygems'require'selenium-webdriver'# Input capabilities
profile = selenium::WebDriver::Firefox::Profile.new
profile['browser.download.folderList']=1
profile['browser.download.manager.showWhenStarting']=false
profile['browser.download.manager.focusWhenStarting']=false
profile['browser.download.useDownloadDir']=true
profile['browser.helperApps.alwaysAsk.force']=false
profile['browser.download.manager.alertOnEXEOpen']=false
profile['browser.download.manager.closeWhenDone']=true
profile['browser.download.manager.showAlertOnComplete']=false
profile['browser.download.manager.useWindow']=false# You will need to find the content-type of your app and set it here.
profile['browser.helperApps.neverAsk.saveToDisk']="application/octet-stream"
capabilities ={'bstack:options'=>{"os"=>"Windows","osVersion"=>"10",},"browserName"=>"Firefox","browserVersion"=>"latest",}
driver = selenium::WebDriver.for(:remote,:url=>"https://YOUR_USERNAME:YOUR_ACCESS_KEY@hub-cloud.browserstack.com/wd/hub",:capabilities=> capabilities
)
driver.navigate.to "https://rubygems.org/gems/selenium-webdriver"
driver.find_element(:id=>'download').click
driver.quit
Test download functionality in the different browsers including Chrome, Edge, and Firefox.
importorg.openqa.selenium.WebDriver;importorg.openqa.selenium.WebElement;importorg.openqa.selenium.remote.DesiredCapabilities;importorg.openqa.selenium.remote.RemoteWebDriver;importorg.openqa.selenium.By;importorg.openqa.selenium.JavascriptExecutor;importjava.io.FileOutputStream;importjava.io.OutputStream;importjava.util.Base64;importjava.net.URL;publicclassFileDownload{publicstaticfinalString BROWSERSTACK_USERNAME ="YOUR_USERNAME";publicstaticfinalString BROWSERSTACK_ACCESS_KEY ="YOUR_ACCESS_KEY";publicstaticfinalString URL ="https://"+ BROWSERSTACK_USERNAME +":"+ BROWSERSTACK_ACCESS_KEY +"@hub-cloud.browserstack-ats.com/wd/hub";publicstaticvoidmain(String[] args)throwsException{DesiredCapabilities capabilities =newDesiredCapabilities();
capabilities.setCapability("browserName","Chrome");
capabilities.setCapability("browserVersion","latest");HashMap<String,Object> browserstackOptions =newHashMap<String,Object>();
browserstackOptions.put("os","Windows");
browserstackOptions.put("osVersion","10");
browserstackOptions.put("sessionName","Bstack-[Java] Sample file download");
capabilities.setCapability("bstack:options", browserstackOptions);WebDriver driver =newRemoteWebDriver(newURL(URL), caps);JavascriptExecutor jse =(JavascriptExecutor) driver;
driver.get("https://www.browserstack.com/test-on-the-right-mobile-devices");Thread.sleep(2000);
driver.findElement(By.id("accept-cookie-notification")).click();// Find element by class name and store in variable "Element"WebElementElement= driver.findElement(By.className("icon-csv"));// This will scroll the page till the element is found
jse.executeScript("arguments[0].scrollIntoView();",Element);
jse.executeScript("window.scrollBy(0,-100)");Thread.sleep(1000);// Click on the element to download the fileElement.click();Thread.sleep(2000);
driver.quit();}}
usingSystem;usingOpenQA.selenium;usingOpenQA.selenium.Remote;usingOpenQA.selenium.Chrome;usingSystem.IO;usingSystem.Threading;namespaceseleniumTest{classFileDownload{staticvoidMain(string[] args){IWebDriver driver;ChromeOptions capability =newChromeOptions();ChromeOptions capabilities =newChromeOptions();
capabilities.BrowserVersion ="latest";Dictionary<string,object> browserstackOptions =newDictionary<string,object>();
browserstackOptions.Add("os","Windows");
browserstackOptions.Add("osVersion","10");
browserstackOptions.Add("projectName","Bstack-[C_sharp] Sample file download");
browserstackOptions.Add("userName","YOUR_USERNAME");
browserstackOptions.Add("accessKey","YOUR_ACCESS_KEY");
browserstackOptions.Add("browserName","Chrome");
capabilities.AddAdditionalOption("bstack:options", browserstackOptions);
driver =newRemoteWebDriver(newUri("https://hub-cloud.browserstack-ats.com/wd/hub/"), capability
);IJavaScriptExecutor jse =(IJavaScriptExecutor) driver;
driver.Navigate().GoToUrl("https://www.browserstack.com/test-on-the-right-mobile-devices");
Thread.Sleep(2000);
driver.FindElement(By.Id("accept-cookie-notification")).Click();// Find element by link text and store in variable "Element" IWebElement Element = driver.FindElement(By.ClassName("icon-csv"));// This will scroll the page till the element is found
jse.ExecuteScript("arguments[0].scrollIntoView();", Element);
jse.ExecuteScript("window.scrollBy(0,-100)");
Thread.Sleep(2000);
Element.Click();
Thread.Sleep(2000);
driver.Quit();}}}
from selenium import webdriver
import time
import base64
desired_cap ={'bstack:options':{"os":"Windows","osVersion":"10","projectName":"Bstack-[Python] Sample file download",},"browserName":"Chrome","browserVersion":"latest",}
options.set_capability('bstack:options', desired_cap)
driver = webdriver.Remote(
command_executor='https://hub-ft.browserstack.com/wd/hub',
options=options)
driver.get("https://www.browserstack.com/test-on-the-right-mobile-devices")
time.sleep(2)# Accept the cookie popup
driver.find_element_by_id("accept-cookie-notification").click()
time.sleep(2)# Find element by class name and store in variable "element"
element = driver.find_element_by_class_name("icon-csv")
driver.execute_script("arguments[0].scrollIntoView();", element)
driver.execute_script("window.scrollBy(0,-100)")
time.sleep(2)# Click on the element to download the file
element.click()
time.sleep(2)
driver.quit()
require'rubygems'require'selenium-webdriver'# Input capabilities
capabilities ={'bstack:options'=>{"os"=>"Windows","osVersion"=>"10","projectName"=>"Bstack-[Ruby] Sample file download",},"browserName"=>"Chrome","browserVersion"=>"latest",}
driver = selenium::WebDriver.for(:remote,:url=>"https://YOUR_USERNAME:YOUR_ACCESS_KEY@hub-cloud.browserstack.com/wd/hub",:capabilities=> capabilities
)
driver.navigate.to "https://www.browserstack.com/test-on-the-right-mobile-devices"
sleep(2)# Accept the cookie popup
driver.find_element(:id,"accept-cookie-notification").click
# Find element by class name and store in variable "element"
element = driver.find_element(:class_name,"icon-csv")
driver.execute_script("arguments[0].scrollIntoView();", element)
driver.execute_script("window.scrollBy(0,-100)")
sleep(2)# Click on the element to download the file
element.click
sleep(2)
driver.quit if driver
importorg.openqa.selenium.WebDriver;importorg.openqa.selenium.WebElement;importorg.openqa.selenium.remote.DesiredCapabilities;importorg.openqa.selenium.remote.RemoteWebDriver;importorg.openqa.selenium.By;importorg.openqa.selenium.JavascriptExecutor;importjava.io.FileOutputStream;importjava.io.OutputStream;importjava.util.Base64;importjava.net.URL;publicclassFileDownload{publicstaticfinalString USERNAME ="YOUR_USERNAME";publicstaticfinalString BROWSERSTACK_ACCESS_KEY ="YOUR_ACCESS_KEY";publicstaticfinalString URL ="https://"+ USERNAME +":"+ BROWSERSTACK_ACCESS_KEY +"@hub-cloud.browserstack-ats.com/wd/hub";publicstaticvoidmain(String[] args)throwsException{DesiredCapabilities capabilities =newDesiredCapabilities();
capabilities.setCapability("browserName","IE");
capabilities.setCapability("browserVersion","11.0");HashMap<String,Object> browserstackOptions =newHashMap<String,Object>();
browserstackOptions.put("os","Windows");
browserstackOptions.put("osVersion","10");
browserstackOptions.put("sessionName","Bstack-[Java] Sample file download");
capabilities.setCapability("bstack:options", browserstackOptions);WebDriver driver =newRemoteWebDriver(newURL(URL), caps);JavascriptExecutor jse =(JavascriptExecutor) driver;
driver.get("https://www.browserstack.com/test-on-the-right-mobile-devices");Thread.sleep(2000);
driver.findElement(By.id("accept-cookie-notification")).click();// Find element by class name and store in variable "Element"WebElementElement= driver.findElement(By.className("icon-csv"));// This will scroll the page till the element is found
jse.executeScript("arguments[0].scrollIntoView();",Element);
jse.executeScript("window.scrollBy(0,-100)");Thread.sleep(1000);// Click on the element to download the fileElement.click();Thread.sleep(2000);
driver.quit();}}
const{Builder, By, Key, until}=require('selenium-webdriver');const fs =require("fs");var sleep =require('sleep');// Input capabilitiesvar capabilities ={'bstack:options':{"os":"Windows","osVersion":"10","projectName":"Bstack-[Node] Sample file download","local":"false","userName":"YOUR_USERNAME","accessKey":"YOUR_ACCESS_KEY",},"browserName":"IE","browserVersion":"11.0",}asyncfunctionmain(){let driver =newwebdriver.Builder().usingServer('https://hub-ft.browserstack.com/wd/hub').withCapabilities(capabilities).build();await driver.get('https://www.browserstack.com/test-on-the-right-mobile-devices')await driver.findElement(By.id('accept-cookie-notification')).click()const element =await driver.findElement(By.className('icon-csv'))await driver.executeScript('arguments[0].scrollIntoView();', element)await driver.executeScript('window.scrollBy(0,-200)')await element.click()
sleep.sleep(2);// Execute this action to click "Save File" button in the browser promptawait driver.executeScript('browserstack_executor: {"action": "saveFile"}')await driver.quit()}main()
usingSystem;usingOpenQA.selenium;usingOpenQA.selenium.Remote;usingOpenQA.selenium.IE;usingSystem.IO;usingSystem.Threading;namespaceseleniumTest{classFileDownload{staticvoidMain(string[] args){IWebDriver driver;MicrosoftEdgeOptions capabilities =newMicrosoftEdgeOptions();
capabilities.BrowserVersion ="latest";Dictionary<string,object> browserstackOptions =newDictionary<string,object>();
browserstackOptions.Add("os","Windows");
browserstackOptions.Add("osVersion","10");
browserstackOptions.Add("projectName","Bstack-[C#] Sample file download");
browserstackOptions.Add("userName","YOUR_USERNAME");
browserstackOptions.Add("accessKey","YOUR_ACCESS_KEY");
browserstackOptions.Add("browserName","IE");
capabilities.AddAdditionalOption("bstack:options", browserstackOptions);
driver =newRemoteWebDriver(newUri("https://hub-ft.browserstack.com/wd/hub/"), capability
);IJavaScriptExecutor jse =(IJavaScriptExecutor) driver;
driver.Navigate().GoToUrl("https://www.browserstack.com/test-on-the-right-mobile-devices");
Thread.Sleep(2000);
driver.FindElement(By.Id("accept-cookie-notification")).Click();// Find element by link text and store in variable "Element" IWebElement Element = driver.FindElement(By.ClassName("icon-csv"));// This will scroll the page till the element is found
jse.ExecuteScript("arguments[0].scrollIntoView();", Element);
jse.ExecuteScript("window.scrollBy(0,-100)");
Thread.Sleep(2000);
Element.Click();
Thread.Sleep(2000);
jse.ExecuteScript("browserstack_executor: {\"action\": \"saveFile\"}");
Thread.Sleep(2000);
driver.Quit();}}}
from selenium import webdriver
import time
import base64
desired_cap ={'bstack:options':{"os":"Windows","osVersion":"10","projectName":"Bstack-[Python] Sample file download",},"browserName":"IE","browserVersion":"11.0",}
options.set_capability('bstack:options', desired_cap)
driver = webdriver.Remote(
command_executor='https://hub-ft.browserstack.com/wd/hub',
options=options)
driver.get("https://www.browserstack.com/test-on-the-right-mobile-devices")
time.sleep(2)# Accept the cookie popup
driver.find_element_by_id("accept-cookie-notification").click()
time.sleep(2)# Find element by class name and store in variable "Element"
element = driver.find_element_by_class_name("icon-csv")
driver.execute_script("arguments[0].scrollIntoView();", element)
driver.execute_script("window.scrollBy(0,-100)")
time.sleep(2)# Click on the element to download the file
element.click()
time.sleep(2)# Execute this action to click "Save File" button in the browser prompt
driver.execute_script('browserstack_executor: {"action": "saveFile"}')
time.sleep(2)
driver.quit()
require'rubygems'require'selenium-webdriver'# Input capabilities
capabilities ={'bstack:options'=>{"os"=>"Windows","osVersion"=>"10","projectName"=>"Bstack-[Ruby] Sample file download",},"browserName"=>"IE","browserVersion"=>"11.0",}
driver = selenium::WebDriver.for(:remote,:url=>"https://YOUR_USERNAME:YOUR_ACCESS_KEY@hub-cloud.browserstack.com/wd/hub",:capabilities=> capabilities
)
driver.navigate.to "https://www.browserstack.com/test-on-the-right-mobile-devices"
sleep(2)# Accept the cookie popup
driver.find_element(:id,"accept-cookie-notification").click
# Find element by class name and store in variable "element"
element = driver.find_element(:class_name,"icon-csv")
driver.execute_script("arguments[0].scrollIntoView();", element)
driver.execute_script("window.scrollBy(0,-100)")
sleep(2)# Click on the element to download the file
element.click
sleep(2)# Execute this action to click "Save File" button in the browser prompt
driver.execute_script('browserstack_executor: {"action": "saveFile"}')
sleep(2)
driver.quit if driver
Work with the downloaded file
BrowserStack provides a range of JavaScript executors to help you work with downloaded files. Use the following tabs to learn about different Javascript executors:
Protip:
Any of the custom Javascript executors will work even if fileName argument is not passed. The results will be for the last downloaded file in the session.
caps['javascriptEnabled']='true'#Additionally, include this capability for JavaScript executors to work
driver.execute_script('browserstack_executor: {"action": "fileExists", "arguments": {"fileName": "<file name>"}}')
The fileExists function within the browserstack_executor script returns a boolean value as a response.
Use the above code snippets to verify whether a specific file was downloaded.
Protip:
The following snippet verifies whether the last file was downloaded in the test session.
caps['javascriptEnabled']='true'#Additionally, include this capability for JavaScript executors to work
driver.execute_script('browserstack_executor: {"action": "fileExists"}')
caps['javascriptEnabled']='true'#Additionally, include this capability for JavaScript executors to work
driver.execute_script('browserstack_executor: {"action": "getFileProperties", "arguments": {"fileName": "<file name>"}}')
You can verify the integrity of the downloaded file using the getFileProperties function in your code using the above code snippet.
The function returns a JSON response as follows:
{"created_time":1607951826,"md5":"71d277eaaa7b2ba6f63eda04dad1a6b4","changed_time":1607951826,"modified_time":1607951826,"size":3187,"file_name":"Browserstack-List of devices to test.csv"}
The properties’ parameters are defined as follows:
created_time: The time when file was downloaded.
md5: The md5 checksum value of the downloaded file. You can verify the integrity of the file using this value.
changed_time: The time at which the file permission or file content is changed.
modified_time: The time at which the file content is changed.
caps['javascriptEnabled']='true'#Additionally, include this capability for JavaScript executors to work
driver.execute_script('browserstack_executor: {"action": "getFileContent", "arguments": {"fileName": "<file name>"}}')
You can transfer the downloaded file from the BrowserStack remote instance to your machine using the getFileContent function that returns the downloaded file as a Base64-encoded string. If you do not know the file name, you can get the content of the last downloaded file in the session by omitting the fileName argument. Use 'browserstack_executor: {"action": "getFileContent"}' and save the response in your local system as shown in the above code sample.
You can use the BrowserStack executor, getFileContent, to download a file that’s up to 30 MB in size.
Did this page help you?
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
Thank you for your valuable feedback
ON THIS PAGE
Is this page helping you?
Yes
No
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked