public class TestBase { public static Logger App_Logger=null; public static Properties Config=null; public static Properties OR=null; public static Xls_Reader suitexls=null; public static Xls_Reader suite_shop_xls=null; public static Xls_Reader suite_cart_xls=null; public static Xls_Reader suite_productdisplay_xls=null; public static boolean isInitalize=false; public static WebDriver driver=null; public static boolean isBrowserOpened=false;
public void initialize() throws IOException{ if(!isInitalize){
// selenium RC/ Webdriver // open a browser if its not opened public void openBrowser(){ if(!isBrowserOpened){ if(Config.getProperty("browserType").equals("MOZILLA")) driver = new FirefoxDriver(); else if (Config.getProperty("browserType").equals("IE")) driver = new InternetExplorerDriver(); else if (Config.getProperty("browserType").equals("CHROME")) driver = new ChromeDriver();
@Test public void TestcaseA1() throws Exception{ //test runmodes of current dataset count++; if(!runmodes[count].equalsIgnoreCase("Y")){ skip=true; throw new SkipException("Testdata runmode set to no: "+ count); } App_Logger.debug("Executing Testcase A1");
WebElement feature_view=driver.findElement(By.className("featured-view")); int tot_img=feature_view.findElements(By.tagName("img")).size(); System.out.println("Number of images"+tot_img);
WebElement addbuttons=driver.findElement(By.className("featured-view")); int button=addbuttons.findElements(By.className("product-details")).size(); System.out.println("Number of add buttons"+button); //driver.quit(); closeBrowser(); }
//check suite to skip or not @BeforeSuite public void CheckSuiteSkip() throws IOException{ initialize(); App_Logger.debug("checking Shop Suite Runmode");
if(!TestUtil.isSuiteRunnable(suitexls, "Shop Suite")){ App_Logger.debug("skiped Shop Suite as runmode is set to No "); throw new SkipException("Runmode of Shop Suite is set to No"); } } }
M
Replied on 29/07/2016
Thanks no need to reply.... i did double quots for value of key in config file browserType="IE" instead of browserType=IE