zoukankan      html  css  js  c++  java
  • GUI__文件上传__driver对象

    一、代码如下

    package www.gui.v2;
    
    import java.util.concurrent.TimeUnit;
    
    import org.openqa.selenium.By;
    import org.openqa.selenium.WebDriver;
    import org.openqa.selenium.WebElement;
    import org.openqa.selenium.firefox.FirefoxDriver;
    import org.openqa.selenium.interactions.Actions;
    
    public class FileUpload {
    	WebDriver driver= null;
    	Actions actions= null;
    	public static void main(String[] args) {
    		// TODO Auto-generated method stub
    		FileUpload gx= new FileUpload();
    		gx.init();
    
    	}
    	
    	private void init() {
    		// TODO Auto-generated method stub
    		// TODO Auto-generated method stub
    		// System.setProperty("webdriver.firefox.bin", "D:\Mozilla
    		// Firefox\firefox.exe");
    		System.setProperty("webdriver.firefox.bin", "D:\FireFox__37\firefox.exe");
    
    		this.driver = new FirefoxDriver();// 启动火狐浏览器
    
    		this.driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);// 元素等待时间
    		this.driver.manage().timeouts().pageLoadTimeout(30, TimeUnit.SECONDS);// 页面加载时间
    		this.driver.manage().timeouts().setScriptTimeout(30, TimeUnit.SECONDS);// ajax请求
    		this.driver.manage().window().maximize();
    		// this.driver.get("https://www.baidu.com/");// 在浏览器中打开该网址
    		actions = new Actions(driver);
    		
    		this.driver.get("http://localhost/secure/view.php?id=last");
    		this.driver.findElement(By.partialLinkText("新增")).click();
            //this.driver.findElement(By.name("attachment")).click();
            this.driver.findElement(By.name("attachment")).sendKeys("C:\Users\Administrator\Desktop\start___All.bat");
            this.driver.findElement(By.xpath("/html/body/table/tbody/tr[8]/td/input")).click();
    	}
    	
    	
    
    }
    
  • 相关阅读:
    服务器时间同步
    DataX部署安装
    Mysql ERROR 1205 (HY000): Lock wait timeout exceeded; try restarting transaction 解决方法
    mysql 使用需要注意的问题
    利用mysqldump 将一个表按条件导出数据
    mysql存储引擎分类
    MySQL数据备份之mysqldump使用
    count(1)、count(*)与count(列名)的执行区别
    rsync + sersync 实现实时数据同步
    ipmitool 工具使用
  • 原文地址:https://www.cnblogs.com/wujianbo123/p/7667823.html
Copyright © 2011-2022 走看看