Hi Friends,
Below is the sample code, which will help you to open chrome browser through selenium.
import org.testng.annotations.AfterTest;
import org.testng.annotations.Test;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.BeforeTest;
public class openingChrome {
public WebDriver driver;
// Launching Browser
@BeforeTest
public void start() {
System.setProperty("webdriver.chrome.driver", "D:\\chromedriver.exe");
driver = new ChromeDriver();
}
// Opening webpage
@Test
public void openHomepage() {
driver.get("http://jaingoruav999.blogspot.com");
}
// Closing browser
@AfterTest
public void teardown()
{
driver.quit();
}
}
Below is the sample code, which will help you to open chrome browser through selenium.
import org.testng.annotations.AfterTest;
import org.testng.annotations.Test;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.BeforeTest;
public class openingChrome {
public WebDriver driver;
// Launching Browser
@BeforeTest
public void start() {
System.setProperty("webdriver.chrome.driver", "D:\\chromedriver.exe");
driver = new ChromeDriver();
}
// Opening webpage
@Test
public void openHomepage() {
driver.get("http://jaingoruav999.blogspot.com");
}
// Closing browser
@AfterTest
public void teardown()
{
driver.quit();
}
}
Your post is amazing and informative too. Very grateful that you shared. I work at Software testing Company and i think this info can turn out to be useful in future.
ReplyDeleteThanks Vidhi. Just let me know, in case you need any help from my side.
Delete