hwnd,function,mouse
常用接口說明,了解以下接口,大部分PC耑自動化測試基本妥了
//導入庫
import key;
import win;
importmouse;
import winex;
import com.picture
//右鍵拖拽
mouse_rb_drag = function(_x, _y){
mouse.rb.down();
mouse.moveTo(_x, _y, true, 10, 10);
mouse.rb.up();
}
//拖拽
mouse_drag = function(_x, _y){
mouse.drag(_x, _y, true, 10, 10);
}
//鼠標移動
mouse_move = function(_x, _y){
mouse.move( _x, _y, true);
}
//鼠標點擊
mouse_click = function(){
mouse.click();
}
//鼠標點擊
mouse_coord_click = function(_x, _y){
mouse.click(_x, _y, true);
}
//鼠標點擊
mouse_coord_clickDb = function(_x, _y){
mouse.clickDb(_x, _y, true);
}
//鼠標滾動
mouse_roll = function(_number){
mouse.mb.roll(_number);
}
//鍵磐輸入
key_send = function(_content){
key.send(_content);
}
//全選
key_ctrl_a = function(){
key.combine("CTRL","A");
}
//清除
key_back = function(){
key.press(key.VK.BACK);
}
//刪除
key_delete = function(){
key.press(key.VK.DELETE);
}
//查找窗口
window_find_class = function(_class){
var _hwnd = win.find(_class)
return _hwnd;
}
//查找窗口
window_find_title = function(_title){
var _hwnd = win.find(, _title);
return _hwnd;
}
//查找窗口
window_find_class_title = function(_class, _title){
var _hwnd = win.find(_class, _title);
return _hwnd;
}
//彈窗控件點擊
window_button_click = function(_hclass, _htitle, _bindex, _bclass){
var hwnd = winex.find(_hclass, _htitle);
var hbutton = winex.findEx(hwnd, _bindex, _bclass);
winex.click(hbutton);
}
//彈窗控件發送
window_edit_send = function(_hclass, _htitle, _eindex, _eclass, _etext){
var hwnd = winex.find(_hclass, _htitle);
var hedit = winex.findEx(hwnd, _eindex, _eclass);
winex.setText(hedit, _etext);
}
//前置窗口
window_foreground = function(_hwnd){
win.setForeground(_hwnd);
}
//最大化
window_max = function(_hwnd){
win.show(_hwnd, 0x3);
}
//關閉窗口
window_close = function(_hwnd){
win.close(_hwnd);
}
//消息框
message = function(_message, _title){
return win.msgboxTimeout(_message, _title, 3000, 0x1 | 0x20);
}
//截屏
screenshot = function(_image){
var picture = com.picture.snap();
picture.Save( _image );
}
0條評論