QTP模拟键盘右键回放失败
代码如下:Dim wshShell, newx, newy
Dim x1, y1,w,h
'get the image position
Browser("TechExcel KnowledgeWise").Page("TechExcel KnowledgeWise").Frame("folderTree").WebElement("Spec Root").Click
x1 = CInt(Browser("TechExcel KnowledgeWise").Page("TechExcel KnowledgeWise").Frame("folderTree").WebElement("Spec Root").GetROProperty("abs_x"))
y1 = CInt(Browser("TechExcel KnowledgeWise").Page("TechExcel KnowledgeWise").Frame("folderTree").WebElement("Spec Root").GetROProperty("abs_y"))
w=Browser("TechExcel KnowledgeWise").Page("TechExcel KnowledgeWise").Frame("folderTree").WebElement("Spec Root").GetRoProperty("width")
h=Browser("TechExcel KnowledgeWise").Page("TechExcel KnowledgeWise").Frame("folderTree").WebElement("Spec Root").GetRoProperty("height")
newx=x1+w/2
newy=y1+h/2
'right-click onthrough object
Browser("TechExcel KnowledgeWise").Page("TechExcel KnowledgeWise").Frame("folderTree").WebElement("Spec Root").Click newx, newy, micrightbtn
wait 1
Set wshShell = CreateObject("WScript.Shell")
For i=1 to 1
wshShell.SendKeys "{DOWN}" '模拟键盘操作
Next
wait 1
wshShell.SendKeys "{ENTER}" '模拟键盘操作
'End Function
很奇怪,回放的时候右键的菜单并没有跳出来, 不知道是什么原因, 求大虾帮忙看看。 我自己换了种方法,可以了~~~~
DeviceReplay方法
页:
[1]