博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
[Selenium]如何实现上传本地文件
阅读量:4678 次
发布时间:2019-06-09

本文共 882 字,大约阅读时间需要 2 分钟。

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.");	}

 

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

 

转载于:https://www.cnblogs.com/MasterMonkInTemple/p/3737255.html

你可能感兴趣的文章
c语言之gdb调试。
查看>>
位反转的最佳算法
查看>>
常用面试问题
查看>>
第一个爬虫
查看>>
Java面试知识点之Java基础
查看>>
老外的前端面试题
查看>>
架构:新浪架构师谈微博架构
查看>>
SQL 语句速查
查看>>
女孩·有义务让男孩走向成熟,·男孩·有责任让女孩学着长大(精简版)
查看>>
discuz 删除指定条件的资讯
查看>>
Android上下文菜单ContextMenu
查看>>
JavaScript Number 对象 Javascript Array对象 Location 对象方法 String对象方法
查看>>
Python & Django 学习笔记
查看>>
python第四天练习题
查看>>
【bzoj4543】Hotel加强版(thr)
查看>>
没有标题(1)
查看>>
React-Native学习手册----搭建基于ios平台的开发环境
查看>>
Android手机 Fildder真机抓包
查看>>
[stm32] 中断
查看>>
L1-043 阅览室
查看>>