python3、selenium、autoit3,通過flash控件上傳文件


autoit.au3

#include <Constants.au3>

WinWait("打開","",20);     //暫停執行腳本,直到上傳對話框出現
WinActive("打開")
WinWaitActive("打開","",5);    //激活上傳窗口
ControlFocus("打開", "", "[CLASS:Edit; INSTANCE:1]")
ControlSetText("打開", "", "[CLASS:Edit; INSTANCE:1]", "C:\DATA\Get It Started.mp4"); //輸入路徑

Send("!o"); //鍵盤快捷鍵Alt+O

將autoit.au3文件通過Compile Script to .exe編譯成.exe文件

python

import os  #引入os庫
……
……

self.driver.find_element_by_id(“XXX”).click() #點擊上傳按鈕,顯示出文件選擇框
os.system("C:\\autoit3.exe")  #調用文件

……
……其他過程省略

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM