package test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.Test;
public class lesson9 {
@Test
public void test() throws InterruptedException{
System.setProperty(“webdriver.chrome.driver”, “D:/01 Learn WebDriver/chromedriver.exe”);
WebDriver dr = new ChromeDriver();
dr.manage().window().maximize();
dr.get(“http://www.layui.com/demo/upload.html”);
Thread.sleep(3000);
//上传文件
WebElement el1 = dr.findElement(By.id(“test”));
el1.sendKeys(“d:/1.jpg”);
//dr.quit();
}
}
原创文章,作者:kepupublish,如若转载,请注明出处:https://blog.ytso.com/tech/opensource/191974.html