import org.junit.*;
import static org.junit.Assert.*;
import com.thoughtworks.selenium.*;
import java.text.SimpleDateFormat;
\D1{!t2p%y"b0
//小匡的应用:学以致用哇
public class TestByKuang extends Search {
}Iea$|-R1r0v0
public static Selenium localSelenium;
#FpTyB-`:f0
@Before
public void init() {
localSelenium = selenium;
}
51Testing软件测试网Z;d&@;Il!h;g.@
//小匡应用1:测试selenium添加新浪微博
@Test
public void testAddWeibo(){
open("http://weibo.com/");
//登录,微博密码保密哦
String xpath = "//input[@id='loginname']";
selenium.type(xpath, "********@126.com");
xpath = "//input[@id='password']";
selenium.type(xpath, "************");
xpath="//a[@id='login_submit_btn']";
selenium.click(xpath);
Util.mySleep(5000);
xpath = "//div[@class='inputarea']/textarea[@id='publish_editor']";
Date now = new Date();
SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss");
selenium.type(xpath, "
Test自动发布新浪微博by selenium @ "+sdf.format(now));
Util.mySleep(5000);
xpath="//div[@class='connBg']/div/a[@id='publisher_submit']";
selenium.click(xpath);
Util.mySleep(5000);
}