1. 程式人生 > 實用技巧 >robotframework踩坑8--AutoItLibrary操作

robotframework踩坑8--AutoItLibrary操作

demo3
    # 執行計算器程式    # run C:\personal\npp.7.8.9.bin.x64\notepad++.exe
    run    calc.exe
    # 等待窗口出現 win wait active | [ WindowTitle | WindowText=WindowText | TimeOut=TimeOut ]
    win wait active    計算器    \    5
    # control click | [ strTitle=strTitle | strText=strText | strControl=strControl | strButton=left | nNumClicks=1 | nX=-2147483647 | nY=-2147483647 ]
# control click 比座標點選更穩定,但windows10的計算器獲取的元素control屬性值都相同,改用其他方式測試 # 滑鼠點選 mouse click | [ strButton=strButton | nX=nX | nY=nY | nClicks=1 | nSpeed=-1 ] # 利用座標方式點選元素容錯率超級低(座標經常改變),不可取 mouse click left 119 307 # 8 mouse click left 276 415 # + mouse click left 119 416 #
2 mouse click left 279 470 # = # 輸入鍵盤字元 send | [ strSendText=4{+}6{=} | nMode=0 ] # {}除字母、數字外其他字元 send 4{+}6{=} sleep 2 # 關閉 win close | [ StrTitle=Title ] win close 計算器 demo 4 run calc.exe # 組合鍵操作 {ALTDOWN}按下 | {ALTUP}釋放 send {ALTDOWN} send a send x send {ALTUP}
# 關閉程序 process close | [ strProcess=strProcess ] process close calc.exe # 獲取視窗寬度 ${var1} | Win Get Client Size Width | [ strTitle=strTitle | strText=strText ] # 獲取視窗高度 ${var2} | Win Get Client Size Height | [ strTitle=strTitle | strText=strText ] # 獲取視窗標題 ${var3} | Win Get Title | [ strTitle=strTitle | strText=strText ] # 設定視窗標題 Win Set Title | [ strTitle=strTitle | strText=strText | strNewTitle=strNewTitle] # 更多用法參考它的幫助文件吧~~~~~