TA的每日心情 | 开心 2014-10-29 13:07 |
---|
签到天数: 3 天 连续签到: 3 天 [LV.2]测试排长
|
3#
楼主 |
发表于 2014-10-24 13:37:55
|
只看该作者
package com;
import junit.framework.TestCase;
import com.thoughtworks.selenium.*;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
public class testPage extends SeleneseTestCase{
private Selenium selenium;
@SuppressWarnings("deprecation")
@Before
public void setUp() throws Exception {
setUp("http://www.baidu.com","*firefox C:\\MozillaFirefox\\firefox.exe");
//String url="www.baidu.com";
//selenium = new DefaultSelenium("localhost",4444, "*firefox C:\\MozillaFirefox\\firefox.exe", url);
//selenium.start();
}
@Test
public void testPage1() throws Exception {
selenium.open("/");
selenium.click("id=kw");
String name=selenium.getTitle();
System.out.println(name);
selenium.setSpeed("100000");
selenium.type("id=kw", "ruby");
selenium.click("id=su");
selenium.waitForPageToLoad("30000");
selenium.click("link=Ruby_百度百科");
}
@After
public void tearDown() throws Exception {
selenium.stop();
}
}
|
|