public class LoginTest extends TestCase {
private Selenium selenium;
private String URL = "http://whbbs.soufun.com/soufun_forum/login.aspx?ErrorCode=1&backurl=http://whbbs.soufun.com/soufun_forum/post/frm_speak.aspx?sign=2610878832^bid=-1&sign=2610878832&bid=-1";
public void setUp() throws Exception {
selenium = new DefaultSelenium("localhost", 4444, "*firefox", URL);
selenium.start();
}
public void tearDown() throws Exception {
selenium.stop();
}
public void testLogin() {
selenium.open(URL);
selenium.type("username", "messon619");
selenium.type("password", "messon619");
selenium.click("//input[@type='submit']");
selenium.waitForPageToLoad("30000");
selenium.type("html_topic", "da jiang you");
selenium.selectFrame("EditorForm"); //这里需要选择你要操作的iframe
selenium.type("//body",
"zong suan ce shi tongguo liao neng zidong fa tiezi liao, haha!"); //这里是在iframe 里面操作
selenium.selectFrame("relative=top"); //这里需要跳出iframe
selenium.click("//form[@id='frmAnnounce']/div/div[8]/div[2]/div[2]/div[1]/input"); //这里是在iframe 外面操作。
}
}
private Selenium selenium;
private String URL = "http://whbbs.soufun.com/soufun_forum/login.aspx?ErrorCode=1&backurl=http://whbbs.soufun.com/soufun_forum/post/frm_speak.aspx?sign=2610878832^bid=-1&sign=2610878832&bid=-1";
public void setUp() throws Exception {
selenium = new DefaultSelenium("localhost", 4444, "*firefox", URL);
selenium.start();
}
public void tearDown() throws Exception {
selenium.stop();
}
public void testLogin() {
selenium.open(URL);
selenium.type("username", "messon619");
selenium.type("password", "messon619");
selenium.click("//input[@type='submit']");
selenium.waitForPageToLoad("30000");
selenium.type("html_topic", "da jiang you");
selenium.selectFrame("EditorForm"); //这里需要选择你要操作的iframe
selenium.type("//body",
"zong suan ce shi tongguo liao neng zidong fa tiezi liao, haha!"); //这里是在iframe 里面操作
selenium.selectFrame("relative=top"); //这里需要跳出iframe
selenium.click("//form[@id='frmAnnounce']/div/div[8]/div[2]/div[2]/div[1]/input"); //这里是在iframe 外面操作。
}
}