QTP学习笔记(一)

上一篇 / 下一篇  2010-04-01 20:48:36 / 个人分类:QTP

由于刚学习QTP,对其中的一些语法、规范等不是很清楚,于是常常犯错。希望我记录的这些错误可以帮助那些初学者

错误一:
    If hadlogin Then Browser("AONE").Page("AONE").Frame("Frame").Link("注销").Click
讲解:
    属于语法错误,QTP中似乎规定“then”后不能直接跟执行语句,必须换行。
    正确的表示应该是
    If hadlogin Then
    Browser("AONE").Page("AONE").Frame("Frame").Link("注销").Click 
----------------------------------------------------------------
错误二:
    未设置前后传递的参数,报错信息如下
    You specified more parameters in your RunAction statement than the number of parameters defined for the action.
讲解:
    在写第一个登录脚本时报了上面的错误,那是我一直查不到原因,后来才发现虽然在脚本上对参数传递做了描述,但在action properties内并没有任何记录。正确的做法是
    keyword view中选择action右击->action properties->parameters,增加input parameters
----------------------------------------------------------------
错误三:
    QTP9.2和IE7.0的兼容问题,报错信息如下
    This run was performed on Internet Explorer 7.x without the required 'Enable Tabbed Browsing' option cleared. Therefore, steps performed on this browser may have unexpected results. It is recommended to clear the 'Tools > Internet Options > Advanced > Enable Tabbed Browsing' option in Internet Explorer and then run this test again.
讲解:
    可以做如下三个操作来避免
    1.把IE7.0设为默认浏览器 
    2.清理IE插件(QTP录制时打开IE后,IE关闭信息提示中的插件) 
    3.Internet选项——常规选项卡中“选项卡”的设置取消勾选“启用选项卡式浏览”
----------------------------------------------------------------
错误四:
    将action移植过来时,无法进行相对路径引用
讲解:
    Tools->options->folders 增加D:\perth_ta路径
----------------------------------------------------------------
错误五:
    从另一个action中传值调用该function,如调用loginperth(url, login_name),出现无法打开指定URL的网页
讲解:
     在function所在action内加
    url= Parameter("url")
    login_name= Parameter("login_name")


TAG: QTP qtp 错误

 

评分:0

我来说两句

日历

« 2024-04-24  
 123456
78910111213
14151617181920
21222324252627
282930    

数据统计

  • 访问量: 6507
  • 日志数: 8
  • 建立时间: 2010-01-20
  • 更新时间: 2010-04-01

RSS订阅

Open Toolbar