一: Action的参数调用1
1、 设置参数
Action Properters >> Action Parameter
增加input的参数和output的参数
2、 Action 1 的脚本:
parameter("output")="Action1 Output"
msgbox("Action1 Input:"¶meter("input"))
msgbox("Action1 Output:"¶meter("output"))
3、 Action 2 的脚本:
RunAction "Action1", oneIteration,"Action2 Input",action2
//设置"Action2 Input",存储输出参数的值为变量:action2
msgbox("Output in Action2:"&action2)
我们不难发现在QTP的Action之间关系
作为被调用Action1,都是使用parameter("参数名")来使用的。
作为调用Action1的Action2而言,input参数是可以往被调用Action1的操作输入的参数。Output的参数是从被调用的Action1返回的值。
Browser("办公自动化系统").Page("办公自动化系统").Frame("mainFrame").WebElement("innertext:="&action2).Click
二、Action的参数调用2
也可以通过Global的DataTable设置参数,
比如 action1 里面 DataTable.value("colname","Global")="参数"
在action2里面 可以直接用dim colname
colname=DataTable.value("colname","Global")