import org.junit.*;
import static org.junit.Assert.*;
import com.thoughtworks.selenium.*;
import java.text.SimpleDateFormat;
51Testing软件测试网0cy.~3aJ`zb%o
//小匡的应用:学以致用哇
public class TestByKuang extends Search {
'rFAcdvS h4y0
public static Selenium localSelenium;
)G
`:{f:eu0`0
@Before
public void init() {
localSelenium = selenium;
}
W r'B:MZN,@0
//小匡应用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);
}