標籤:rom ndk generate 帳號 register manage ati com files
完整代碼實現如下:
package linear;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
/*
* 李盈輝
*2016-12-2
* */
public class loginCase {
// TODO Auto-generated constructor stub
public static void main(String[] args) throws Exception{
WebDriver driver;
System.setProperty("webdriver.chrome.marionette","C:\\Program Files (x86)\\Google\\Chrome\\Application\\geckodriver.exe");
driver = new ChromeDriver();
driver.manage().window().maximize();
System.out.println("瀏覽器已經啟動");
//在網站註冊帳號,並替換成自己的帳號和密碼,即可實現登入
driver.get("https://www.tangcredit.com/");
driver.findElement(By.xpath("//div[@id=‘register518‘]/span[2]")).click();
Thread.sleep(5000);
driver.findElement(By.id("model_phone")).clear();
driver.findElement(By.id("model_phone")).sendKeys("tell-phone");
driver.findElement(By.id("model_password")).clear();
driver.findElement(By.id("model_password")).sendKeys("password");
driver.findElement(By.cssSelector("input.btn.btn-danger")).click();
System.out.println("使用者已經登入");
}
}
selenium2-java 瀏覽器下進行登入