package com.gubo;
import junit.framework.TestCase;
import org.testng.annotations.*;
import com.thoughtworks.selenium.DefaultSelenium;
import com.thoughtworks.selenium.Selenium;
public class TestPage2 extends TestCase {
private Selenium selenium;
@BeforeTest
public void prevshell()
{
System.out.println("now,let's begin");
}
@AfterTest
public void aftershell()
{
System.out.println("ok,succeed?");
}
@Parameters({ "v_1" })
@Test
public void setUp(String v_url) throws Exception
{
String url=v_url;
selenium=new DefaultSelenium("localhost",4444, "*iexplore", url);
System.out.println("init selenium");
selenium.start();
System.out.println("start successfully");
}
@Test
public void tearDown() throws Exception
{
selenium.stop();
}
@Test
public void testGoogleTestSearch() throws Throwable {
System.out.println("enter testGoogleTestSearch");
selenium.open("/");
System.out.println("open the google.com");
selenium.type("q", "selenium");
System.out.println("input type condition");
selenium.click("btnG");
System.out.println("begin search");
selenium.waitForPageToLoad("30000");
assertTrue(selenium.isTextPresent("selenium"));
System.out.println("finsh assert");
}
}