上传文件

HTML源码

<td>sendkeys上传</td>
<div id='pf'><input type='file' id='postfile'/></div>

java代码

 WebElement pf=driver.findElement(By.xpath("//*[@id='pf']/input"));
 pf.sendKeys("C:\\sendkeys.txt");

 

posted @ 2023-04-08 21:39  Mr_sven  阅读(8)  评论(0编辑  收藏  举报