首页 > 其他 > 详细

Selenium如何实现上传本地文件

时间:2014-05-23 11:59:17      阅读:1025      评论:0      收藏:0      [点我收藏+]
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如何实现上传本地文件

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!