概述
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】所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复