Configure WebDriver and TestNG on Eclipse
Write the script in the following way:
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
public class webdriver
{
public WebDriver driver;
@BeforeMethod
public void BM()
{
//Launch the firefox browser
driver=new FirefoxDriver();
}
@Test
public void Test()
{
//Browse the google website
driver.get("http:\\gogle.com");
}
@AfterMethod
public void AM()
{
//close the firefox window
driver.quit();
}
}
Write the script in the following way:
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
public class webdriver
{
public WebDriver driver;
@BeforeMethod
public void BM()
{
//Launch the firefox browser
driver=new FirefoxDriver();
}
@Test
public void Test()
{
//Browse the google website
driver.get("http:\\gogle.com");
}
@AfterMethod
public void AM()
{
//close the firefox window
driver.quit();
}
}
No comments:
Post a Comment