AutoIt Window Info: 用于识别Windows控件信息
Compile Script to.exe: 用于将AutoIt编写的脚本转换成可执行的文件
Run Script: 用于执行AutoIt脚本
SciTE Script Editor: 用于编写AutoIt脚本
auto.py
#coding=utf-8
from selenium import webdriver
import os
driver = webdriver.Chrome()
#打开上传功能页面
file_path = 'file:///' + os.path.abspath('uplad.html')
driver.get(file_path)
#点击打开上传窗口
driver.find_element_by_name("file").click()
#调用upfile.exe上传程序
os.system("D:\\upfile2.exe")
# driver.quit()
upfile2.au3
;ControlFocus("title","text",controlID) Edit1=Edit instance 1
ControlFocus("打开", "","Edit1")
; Wait 10 seconds for the Upload window to appear
WinWait("[CLASS:#32770]","",10)
; Set the File name text on the Edit field
ControlSetText("打开", "", "Edit1", "D:\upload_file.txt")
Sleep(2000)
; Click on the Open button
ControlClick("打开", "","Button1");
uplad.html
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<title>upload_file</title>
<link href="http://cdn.bootcss.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet" />
</head>
<body>
<div class="row-fluid">
<div class="span6 well">
<h3>upload_file</h3>
<input type="file" name="file" />
</div>
</div>
</body>
<script src="http://cdn.bootcss.com/bootstrap/3.3.0/css/bootstrap.min.js"></script>
</html>
网友评论