HcpmsLoginTest
package org.commonpackage.webdriver;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
public class TestLoginFirefoxDriver {
public static void main(String[] args) throws InterruptedException {
System.setProperty("webdriver.firefox.bin", "C:/Program Files/Mozilla Firefox/firefox.exe");
WebDriver driver = new FirefoxDriver();
driver.get("http://mhis-hcpms-stg1.paic.com.cn/mhis/login.html");
driver.manage().window().maximize();
//用户名
WebElement username= driver.findElement(By.name("j_username"));
username.sendKeys("admin");
//密码
WebElement password = driver.findElement(By.name("j_password"));
password.sendKeys("admin");
//登录
WebElement btn = driver.findElement(By.id("submit"));
btn.click();
Thread.sleep(20000);
driver.close();
}
}