码迷,mamicode.com
首页 > 其他好文 > 详细

Selenium如何实现上传本地文件

时间:2014-05-23 12:00:15      阅读:502      评论:0      收藏:0      [点我收藏+]

标签:class   blog   c   code   java   a   

1
2
3
4
5
6
7
8
9
public void uploadLocalFileToServer(String uploadFileName){
        String AutomationPath = System.getProperty("user.dir");
        String filePath=AutomationPath+"\\src\\test\\resources\\testData\\"+uploadFileName;
        logger.info("Upload file path : "+filePath);
        WebElement magnifyIcon = page.getMagnifyIconOfSampleReport();
        magnifyIcon.sendKeys(filePath);
        Assert.assertEquals(page.getSampleReportTxtInput().getAttribute("value"),uploadFileName,uploadFileName+" should be listed in Sample Report .");
        Assert.assertTrue(page.getSampleReportDeleteIcon().isDisplayed(), uploadFileName+" should be listed in Sample Report with a delete icon on the right.");
    }

 

1
2
3
public WebElement getMagnifyIconOfSampleReport(){
        return SeleniumUtil.waitForElementPresent(driver, By.cssSelector("div#tmpmgrDiv div.upsmpbtnc a#upSmp.filea input.file"));
    }

 

Selenium如何实现上传本地文件,布布扣,bubuko.com

Selenium如何实现上传本地文件

标签:class   blog   c   code   java   a   

原文地址:http://www.cnblogs.com/MasterMonkInTemple/p/3737255.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!