0

How to perform file Upload and download in Selendroid with Java? I'm testing the mobile version of a site.. I did upload and download using Selenium webdriver, and it was working perfectly. Please give me a solution for upload/download in Selendroid.

public void startDriver() throws InvalidFileFormatException, IOException{ 


    FirefoxProfile profile = new FirefoxProfile();

    String path1 = "C:\\Downloads_sel";
    profile.setPreference("browser.download.folderList", 2);
    profile.setPreference("browser.download.dir", path1);
    System.out.println(path1);
    profile.setPreference("browser.download.alertOnEXEOpen", false);
    // profile.setPreference("browser.helperApps.neverAsksaveToDisk",
    // "application/x-msexcel,application/excel,application/x-excel,application/excel,application/x-excel,application/excel,application/vnd.ms-excel,application/x-excel,application/x-msexcel,application/pdf,application/xml");
    profile.setPreference(
            "browser.helperApps.neverAsk.saveToDisk",
            "application/msword, application/csv, application/ris, text/csv, image/png, application/pdf, text/html, text/plain, application/zip, application/x-zip, application/x-zip-compressed, application/download, application/octet-stream");
    profile.setPreference("browser.download.manager.showWhenStarting",
            false);
    profile.setPreference("browser.download.manager.focusWhenStarting",
            false);
    profile.setPreference("browser.helperApps.alwaysAsk.force", false);
    profile.setPreference("browser.download.manager.alertOnEXEOpen", false);
    profile.setPreference("browser.download.manager.closeWhenDone", false);
    profile.setPreference("browser.download.manager.showAlertOnComplete",
            false);
    profile.setPreference("browser.download.manager.useWindow", false);
    profile.setPreference("browser.download.manager.showWhenStarting",
            false);
    profile.setPreference(
            "services.sync.prefs.sync.browser.download.manager.showWhenStarting",
            false);
    // ..i commented this line..but it didnt work
    profile.setPreference("pdfjs.disabled", true);       
    driver = new FirefoxDriver(profile);
    driver.manage().window().maximize();
    driver.get(URL1);
    System.out.println("gotURL");

}

This was my code to perform a download in selenium webdriver..and how to do the same in selendroid

Ann
  • 1
  • 3

0 Answers0