AutoIT Example

package SeleniumLearn.COM;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.Test;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.AfterTest;

public class AutoITFileAttachment {
public WebDriver driver;

@Test
public void FileAttachement() throws Exception {
driver.manage().timeouts().implicitlyWait(9, TimeUnit.SECONDS);
driver.get("http://techlearn.in/Register");
driver.findElement(By.id("edit-submitted-uploadfile-upload")).click();

Runtime.getRuntime().exec("C:\\Users\\chinna\\Desktop\\AutoIT\\Fileupload.exe");
}

@BeforeTest
public void beforeTest() {
driver= new FirefoxDriver();
driver.manage().window().maximize();
}

@AfterTest
public void afterTest() {
driver.close();
}
}

 
 

Tags: