打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
有关Environment Variable的一些用法
如何检查Environment Variable是否存在

Public Function IsEnvExist(ByVal varName)
IsEnvExist = True

On Error Resume Next

Dim envVal
envVal = Environment(varName)

If err.number<>0 Then

IsEnvExist = False
End If

On Error Goto 0
End Function

msgBox IsEnvExist("Invalid")


有关Environment Variable被赋值

If we try to use Set to assign an object to the Environment Variable, 'Type mismatch' exception is raised.

1. use a string definition of the object and then convert it to an object 
2. assign the object to the variable without using the Set

Method 1

Environment("BrowserObj") = "Browser(""creationtime:=0"")"

Dim objBrowser

Excute "set objBrowser = "& Environment("BrowserObj")

objBrowser.close 

Method2
Environment("BrowserObj") = Browser("creationtime:=0")
Dim objBrowser

set objBrowser =  Environment("BrowserObj")

objBrowser.close 

How an array is passed using Environment Variable

QTP throws a "this array is fixed or temporarily locked" exception, if we try to pass a fixed length array using Environment Variable.

Dim fixedArr(3)

For i = LBound(fixedArr,1) to UBound(fixedArr,1)
     fixedArr(i) = Cstr(i)
Next

Dim dynArr
dynArr = fixedArr

Environment.Value("passArray") = dynArr
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
QTP环境变量的配置
linux下tomcat无法启动
TensorFlow学习系列(四):利用神经网络实现泛逼近器(universal approxima...
win10专业版能安装上mysql数据库么
Creating Environment variables in Jenkins
阿里云centos7 tomcat启动报错
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服