package com.sample.test;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.testng.Assert;
import org.testng.annotations.AfterTest;
import org.testng.annotations.Test;
public class TestcasesSample {
WebDriver driver1,driver2, driver3;
@Test
public void tester()
{
driver1 = new FirefoxDriver();
driver1.get("http://stackoverflow.com/");
Assert.assertTrue(driver1.getPageSource().contains("stackoverflow"), "Page not loaded");
System.setProperty("webdriver.chrome.driver", "C:/Users/206237/temp/chromedriver.exe");
driver2 = new ChromeDriver();
driver2.get("http://www.tutorialspoint.com/");
driver2.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
Assert.assertTrue(driver2.getPageSource().contains("tutorialspoint"), "Page not loaded");
System.setProperty("webdriver.ie.driver", "D:/MavenSample1/IEDriverServer/IEDriverServer.exe");
driver3 = new InternetExplorerDriver();
driver3.get("http://www.testng.org/doc/index.html");
Assert.assertTrue(driver3.getPageSource().contains("@BeforeClass"), "Page not loaded");
}
@AfterTest
public void tearDown()
{
driver1.close();
driver1.quit();
driver2.close();
driver2.quit();
driver3.close();
driver3.quit();
}
}
No comments:
Post a Comment