zoukankan      html  css  js  c++  java
  • [Selenium]如何实现上传本地文件

    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"));
    	}
    
  • 相关阅读:
    jsonp解决跨域
    rkhunter
    freshclam
    ntpdate
    一个汉字占几个字节
    plsql developer 使用 oracle instantclient的安装和配置
    初学者学习计划
    pslq常用操作
    plsql使用
    Tomcat性能调优方案
  • 原文地址:https://www.cnblogs.com/MasterMonkInTemple/p/3737255.html
Copyright © 2011-2022 走看看