Thursday, May 15, 2014

How to download a Zip file into a Perticular Location

package FileDownloads;

import java.util.concurrent.TimeUnit;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxProfile;

public class FileDownload {

    public static void main(String[] args) throws InterruptedException {
        FirefoxProfile Prof = new FirefoxProfile();
        Thread.sleep(3000);
        Prof.setPreference("browser.download.dir", "D:\\java prj");
        Prof.setPreference("browser.download.folderList", 2);
        Prof.setPreference("browser.helperApps.neverAsk.saveToDisk","application/zip");
        WebDriver driver = new FirefoxDriver(Prof);
        driver.get("http://www.bcfi.be/download/");
        driver.manage().timeouts().implicitlyWait(3,TimeUnit.MINUTES);
        driver.findElement(By.xpath("//*[@id='datatable']/tbody/tr[3]/td[3]/form/input")).click();
    }

}

TestNG - Can i use the 2 different data providers to same @test methods in TestNG?

public Object [][] dp1 () { return new Object [][] { new Object [] { "a" , "b" }, new Obje...