--- title: 'UFT GUItest - Simulating mouse click' disqus: hackmd --- ## UFT GUItest - Simulating mouse click * 模擬滑鼠點選物件 * Micro Focus UFT One 15.0 * [Ref](http://burnignorance.com/software-testing-tips/simulating-mouse-click-operation-through-qtp/) ## :rocket:參考程式 * 假設頁面上有一個"Document"的連結,點右鍵後會出現一個選單,再點選單中的選項"CreateDocument"。 ``` vbscript= Set pathObj = Browser("BrowserName").Page("PageName") -- Create an object of DeviceReplay class which helps us simulate mouse click operation -- Set deviceReplay = CreateObject("Mercury.DeviceReplay") getX = pathObj.Link("Document").GetROProperty("abs_x") getY = pathObj.Link("Document").GetROProperty("abs_y") -- imulates the right click operation over the link -- deviceReplay.MouseClick getX,getY,RIGHT_MOUSE_BUTTON -- Click on the "CreateDocument" option -- pathObj.WebElement("name:=CreateDocument").Click Set deviceReplay = Nothing ``` ## Appendix and FAQ :::info **Find this document incomplete?** Leave a comment! ::: ###### tags: `UFT`,`GUItest`
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up