1,安装autoIt

2,工程中建文件夹,例如:script,将autoit 复制到该文件夹,并且编辑视频所在的文件夹的路径,编辑“au3”格式的文件

3,编辑完成后生成EXE文件(工具自带转换器,转换即可),将AUTOIT文件(au3格式)和刚刚生成的EXE文件放入工程文件夹中;

4,脚本即可调用该软件

phoExePath = curPath + Dom4jXml.getValue("SICK_FIRPHO_PATH");

Reporter.log(phoExePath);

WebElement addfire = driver.findElement(By.id("qiniuFile"));

addfire.click();

Thread.sleep(3000);

try {

//调用autoit exe来上传照片

Runtime.getRuntime().exec(phoExePath);

Thread.sleep(5000);

} catch (IOException e) {

Reporter.log("[ERROR]"+e);

//ScreenShotPC.screenShot("PublishSickCaseWebElements.publishSickCase");

Assert.fail(e.toString());

}

5,INIT.xml的文件内容(xml文本参数)

<?xml version="1.0" encoding="UTF-8"?>

<!--PC启动配置参数-->

<infos>

<capabilities>

<SICK_FIRPHO_PATH>\\script\\addVideo.exe</SICK_FIRPHO_PATH>

</capabilities>

</infos>

参数中包括的exe文件在工程中所在目录

AutoIt实现selenium上传文件的更多相关文章

  1. Java+Selenium 上传文件,点击选择“浏览文件”按钮,报错invalid argument

    Java+Selenium 上传文件,点击选择"浏览文件"按钮,报错invalid argument 解决代码: Actions action=new Actions(driver ...

  2. Selenium上传文件方法总结

    Web上本地上传图片,弹出的框Selenium是无法识别的,也就是说,selenium本身没有直接的方法去实现上传本地文件,这里总结了两种上传文件的方式. 一.利用Robot类处理文件上传. 其大致流 ...

  3. Selenium 上传文件失败,解决办法一

    昨个改程序遇到一个问题,UI上面有需要上传文件的地方.但是我不知道怎么让Selenium完成 点击上传文件按钮->在弹出的文件选择窗口中选择路径和文件,点确定. 要知道弹出窗口属于window的 ...

  4. Selenium上传文件

    selenium自带了对应的API可以上传问题,如果这个上传文件的html code中显示的type是file那么你就可以使用下面的代码上传文件. /** * click the upload but ...

  5. selenium 上传文件方法补充——SendKeys、win32gui

    之前和大家说了input标签的上传文件的方式: <selenium2 python 自动化测试实战>(13)——上传文件 现在好多网站上传的标签并不是input,而是div之类的比如: 全 ...

  6. selenium 上传文件。

    上传文件 driver.findElement(By.xpath("//input[@type='file']"))).sendKeys("C:\\testContent ...

  7. python+selenium上传文件——input标签

    我们要区分出上传按钮的种类,大体上可以分为两种: 第一种普通上传:将本地文件路径作为一个值,放在input标签中,通过form表单将这个值提交给服务器: 第二种插件上传:是通过Flash.JavaSc ...

  8. AutoIT 实现Firefox上传文件

    Firefox浏览器文件上传代码如下: ;upload file Func _UploadFile($file) AutoItSetOption("WinTitleMatchMode&quo ...

  9. selenium上传文件,怎么操作

    #通过os.path.abspath()方法,打开图片的绝对路径,然后,定位上传按钮,然后,send_keys()方法中,添加这个文件路径就可以了

随机推荐

  1. WM (Constants)

    Create page WM (Constants)   Summary WM_* Constants and their definitions or descriptions and what c ...

  2. sql except 用法,找两个表中非共同拥有的

    ;with tt as (select a.id as id from [dbo].[1234] a where a.id not in (select a.ProtocolID from Proto ...

  3. AMBA interconnector PL301(一)

    HPM(High-Performance Matrix)是一个自生成的AMBA3 bus subsystem. 由一个AXI bus matrix,Frequency Conversion Compo ...

  4. libSVM 简易使用手册

    关于SVM的基础理论知识,可以google这篇文章<SVM的八股简介>,讲解得生动有趣,是入门的极好教材.作为拿来主义者,我更关心怎么用SVM,因此瞄上了台湾林智仁教授提供的libSVM. ...

  5. HOWTO Install the MinGW (GCC) Compiler Suite

    Posted July 25th, 2008 by mingwadmin getting started install mingw Automated Installer If you are ne ...

  6. SQL2005中的事务与锁定(二)- 转载

    ------------------------------------------------------------------------ -- Author : HappyFlyStone  ...

  7. an'gularjs 环境搭建之NodeJS、NPM安装配置步骤(windows版本)

    NodeJS.NPM安装配置步骤(windows版本)  :http://xiaoyaojones.blog.163.com/blog/static/28370125201351501113581/ ...

  8. 继承(引用~析构~virtual)

    [1]程序1 #include <iostream> using namespace std; class Base { private: int m_nBase; public: Bas ...

  9. selenium 右键另存为操作

    from selenium import webdriverfrom selenium.webdriver.common.action_chains import ActionChainsbrowse ...

  10. python编码:gbk编码与解码

    从RF输入的中文会进行unicode编码:u'\u6587\u4ef6\u5230\u8fbe\u6210\u529f' 从orc数据库查询到的中文会进行gbk编码得到ASCII:'\xce\xc4\ ...