import java.sql.Time;
import java.util.concurrent.TimeUnit;
import org.junit.BeforeClass;
import org.openqa.selenium.*;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.server.browserlaunchers.Sleeper;
import org.testng.annotations.Test;
public class webdriverdemo {
/**
* @param args
* @throws InterruptedException
*/
public static void main(String[] args) throws InterruptedException {
// TODO Auto-generated method stub
System.setProperty("webdriver.firefox.bin", "D:\Program Files (x86)\Mozilla Firefox\firefox.exe");
WebDriver driver = new FirefoxDriver();
driver.get("http://192.168.2.243:8076/");
Thread.sleep(1000);
//driver.navigate().to("http://www.google.com");
//System.out.print("1 Page title is:" + driver.getTitle());
//WebElement text = driver.findElement(By.name("wd"));
//element.sendKeys("selenium");
//element.click();
//element.getText();
//text.sendKeys("百度");
//text.clear();
WebElement text = driver.findElement(By.name("mobile"));
text.sendKeys("13244763122");
Sleeper.sleepTightInSeconds(1);
WebElement text1 = driver.findElement(By.name("password"));
text1.sendKeys("123456");
WebElement text2 = driver.findElement(By.name("remember"));
text2.click();
//Sleeper.sleepTightInSeconds(1);
WebElement button = driver.findElement(By.tagName("button"));
button.click();
WebElement text4 = driver.findElement(By.className("a2"));
text4.click();
WebElement text5 = driver.findElement(By.className("a2"));
text5.click();
//text.submit();
//driver.navigate().refresh();
//text.clear();
//driver.close();
//driver.quit();
}
觉得不错的可关注微信公众号在手机上观看,让你用手机边玩边看