mardi 2 août 2016

Cross browser test

I have to do login to an application with two different browsers ( IE & FF) and hence I tried to do cross browser test. When the URL gets passed to IE, I am getting link as "Continue to this website not recommended" , whereas the same link will not be displayed in FF. In the below if I use this statement " driver.findElement(By.id("overridelink")).click();" then it works fine in IE but failing in firefox since there wont be any link in FF.

please let me know the possible where one script should run in both the browsers. Below is the script which am trying

@Test @Parameters("browser") public void verifypagetitle(String browsername) {

   if(browsername.equalsIgnoreCase("IE"))
   {
       System.setProperty("webdriver.ie.driver",
                "D:\\2.53.1\\IEDriverServer.exe");
       driver = new InternetExplorerDriver();

   }

   else if (browsername.equalsIgnoreCase("firefox")) 
   {
       System.setProperty("webdriver.firefox.bin",
                "C:\\Program Files\\Mozilla Firefox\\firefox.exe");
       driver = new FirefoxDriver();
   }
     driver.get("URL");
     driver.manage().window().maximize();
     driver.findElement(By.id("overridelink")).click();
     driver.findElement(By.id("j_username")).sendKeys("userid");
     driver.findElement(By.id("j_password")).sendKeys("pwd");
     driver.findElement(By.id("j_password")).submit();

Aucun commentaire:

Enregistrer un commentaire