I am able to run the selenium script (built using keyword library and junit 4) on the silk central server as I see the below script opens up the browser, finished the steps as needed and closed the browser but I still sees the job/test status as running on the silk central.
I uploaded the keyword library to the silk central server from eclipse.
Could you please guide me if I am missing anything in regards to the junit version or am I missing any step?
public class LaunchSelenium{
private static final String propertiesFile ="\\....\\props.txt";
private WebDriver driver=null;;
String url = null;
@Keyword(value = "testSelenium")
@Test
public void testSelenium(String env,String testid) {
// Load Propeties
PropertyService properties = new PropertyServiceImpl();
try {
properties.loadProperties(propertiesFile);
} catch (IOException e) {
e.printStackTrace();
}
// Go to ENV specific login page
switch (environment) {
case "DEV":
url = properties.getValue("DEV.URL");
break;
case "SIT":
url = properties.getValue("SIT.URL");
break;
case "LOCAL":
url = properties.getValue("LOCAL.URL");
break;
default:
url = properties.getValue("DEV.URL");
break;
}
final File file = new File("//..//..Properties/chromedriver.exe");
System.setProperty("webdriver.chrome.driver", file.getAbsolutePath());
driver = (WebDriver) new ChromeDriver();
driver.get(url);
driver.findElement(By.id("UserID")).clear();
driver.findElement(By.id("UserID")).sendKey("uname");
driver.findElement(By.id("password")).clear();
driver.findElement(By.id("password")).sendKeys("upwd");
driver.findElement(By.id("terms")).click();
driver.findElement(By.id("loginSubmit")).click();
driver.findElement(By.id("testid")).sendKeys(test id);
driver.findElement(By.id("find")).click();
driver.findElement(By.id("t2")).click();
driver.findElement(By.id("Edit")).click();
driver.findElement(By.id("rOver")).click();
driver.findElement(By.id("submit")).click();
driver.close();
}
@Keyword(value = "tearDown")
@After
public void tearDown() throws Exception {
}
}