package com.lee.auto.testFrome;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
public class login_2 {
public static void main(String[] args) throws InterruptedException {
case_1();
case_2();
case_3();
}
private static void case_1() throws InterruptedException {
System.setProperty("webdriver.chrome.driver", "src/chromedriver.exe");
ChromeDriver driver = new ChromeDriver();
driver.get("测试url");
driver.findElement(By.xpath("//*[@id="username"]")).sendKeys("15920000001");;
driver.findElement(By.xpath("//*[@id="password"]")).sendKeys("11111111");;
driver.findElement(By.xpath("/html/body/div/div/div[2]/div[2]/form/section[3]/span/input")).click();
Thread.sleep(5000);
driver.close();
}
private static void case_2() throws InterruptedException {
System.setProperty("webdriver.chrome.driver", "src/chromedriver.exe");
ChromeDriver driver = new ChromeDriver();
driver.get("测试url");
driver.findElement(By.xpath("//*[@id="username"]")).sendKeys("15920000001");;
driver.findElement(By.xpath("//*[@id="password"]")).sendKeys("1111");;
driver.findElement(By.xpath("/html/body/div/div/div[2]/div[2]/form/section[3]/span/input")).click();
Thread.sleep(5000);
driver.close();
}
private static void case_3() throws InterruptedException {
System.setProperty("webdriver.chrome.driver", "src/chromedriver.exe");
ChromeDriver driver = new ChromeDriver();
driver.get("测试url");
driver.findElement(By.xpath("//*[@id="username"]")).sendKeys("15720000001");;
driver.findElement(By.xpath("//*[@id="password"]")).sendKeys("11111111");;
driver.findElement(By.xpath("/html/body/div/div/div[2]/div[2]/form/section[3]/span/input")).click();
Thread.sleep(5000);
driver.close();
}
}
最后
以上就是还单身冷风最近收集整理的关于Java写Web自动化用什么框架_web自动化框架抽取示例【Java+selenium】的全部内容,更多相关Java写Web自动化用什么框架_web自动化框架抽取示例【Java+selenium】内容请搜索靠谱客的其他文章。
发表评论 取消回复