一个简单的139邮箱登录脚本--->java-selenium

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;

public class demo {

public static void main(String[] args) {
// TODO Auto-generated method stub
WebDriver dr;
System.setProperty("webdriver.Chrome.mariontte","C:\\driver\\chromedriver.exe");
dr= new ChromeDriver();
dr.get("http://mail.10086.cn");
dr.manage().window().maximize();
//dr.get(Context_variables.url);
WebElement username = dr.findElement(By.id("txtUser"));
WebElement pwd = dr.findElement(By.id("txtPass"));
WebElement Btn = dr.findElement(By.id("cbauto"));
WebElement login = dr.findElement(By.id("loginBtn"));
username.sendKeys("账号");
pwd.sendKeys("密码");
Btn.click();
login.click();

}

}

你可能感兴趣的:(java+selenium)