mardi 27 janvier 2015

Selenium How to read data from Excel file for checkbox value

I'm doing Selenium WebDriver Data Driven framework by passing parameter MovieType checkbox from Excel file


If the checkbox value in html is "y, n, true, or false", Selenium will able to read input data from Excel,


but checkbox value in html is "vnow", how can I set "vnow" to "y, n, true, or false" in selenium


PS: html is done by other developer so I'm not allow to amend it. Any suggestion is welcome. Thanks


html file



<input type="checkbox" onclick="trigger functionA();" tabindex="4" value="vnow" name="movie_Type"/>


selenium java file



public static WebElement chkbx_selectMovieType(WebDriver driver, String value) throws Exception{
try{
List<WebElement> chkbxMovieType = driver.findElements(By.name("movie_Type"));
for(WebElement chkbx : chkbxMovieType){
if(chkbx.getAttribute("value").equalsIgnoreCase(value))
chkbx.click();
}
}catch (Exception e){
throw(e);
}
return element;
}




Aucun commentaire:

Enregistrer un commentaire