Thursday, July 12, 2012

Retrieve the H1 tag Title :



package autoInsurance;


import org.openqa.selenium.server.SeleniumServer;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;


import com.thoughtworks.selenium.DefaultSelenium;
import com.thoughtworks.selenium.Selenium;

public class H1tag {

public Selenium selenium;
public SeleniumServer seleniumserver;

@BeforeClass
public void setUp() throws Exception{

selenium =new DefaultSelenium("localhost",4444,"*chrome", "http://www.loan.com");
selenium.start();

}
@Test
public void TestH1tag() throws Exception{
selenium.open("http://www.loan.com");
selenium.windowMaximize();

// To retirve the H1 tag title selenium.gettext(xpath)
System.out.println("FirstChild of h1 with descendent child "+selenium.getText("css=h1"));
}
@AfterClass
public void tearDown() throws Exception{

selenium.stop();
}
}




No comments:

Post a Comment