package com.seleniumWebdriver;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
/**
* @Blog Name : Selenium Code Example
* @author Deepak Gupta
* @Created Date 7-08-2017
*
*/
public class GetPageSource {
@BeforeTest
public void preCondtion() {
try {
System.setProperty("webdriver.gecko.driver", System.getProperty("user.dir") + "/drivers/geckodriver.exe");
driver = new FirefoxDriver();
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
} catch (Exception e) {
org.testng.Assert.fail("Test failed");
}
}
@AfterClass
public void end(){
driver.quit();
}
@Test
public void handleGetPageSourceExample() {
try {
driver.get("http://www.google.com");
Thread.sleep(2000);
logger.info("page source " + driver.getPageSource());
Thread.sleep(2000);
} catch (Exception e) {
e.printStackTrace();
}
}
}
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
/**
* @Blog Name : Selenium Code Example
* @author Deepak Gupta
* @Created Date 7-08-2017
*
*/
public class GetPageSource {
@BeforeTest
public void preCondtion() {
try {
System.setProperty("webdriver.gecko.driver", System.getProperty("user.dir") + "/drivers/geckodriver.exe");
driver = new FirefoxDriver();
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
} catch (Exception e) {
org.testng.Assert.fail("Test failed");
}
}
@AfterClass
public void end(){
driver.quit();
}
@Test
public void handleGetPageSourceExample() {
try {
driver.get("http://www.google.com");
Thread.sleep(2000);
logger.info("page source " + driver.getPageSource());
Thread.sleep(2000);
} catch (Exception e) {
e.printStackTrace();
}
}
}
No comments:
Post a Comment