Se(10)---上传文件

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Se(10)---上传文件相关的知识,希望对你有一定的参考价值。

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();

}

}


以上是关于Se(10)---上传文件的主要内容,如果未能解决你的问题,请参考以下文章

洪流上传器如何生成视频文件规格和预览?

Flash上传组件之SWFUpload文件上传

Spring的文件上传功能upload

多文件上传中的 OnSubmit 和 OnChange

Codeigniter 上传文件不起作用

jersey+jetty实现文件上传