http://blog.sina.com.cn/s/blog_621a2bdf0100gewc.html

Web ReplayType?(Tarun lalwani)

(2010-01-13 14:46:28)

转载

标签:

杂谈

分类: QTP_VBS

What is ReplayType?

ReplayType is QTP Web Add-in setting. It can be used to change how the events are replayed on the browser. There are two modes of ReplayType

  • Events (1) - Replay of events using the Browser methods (something similar to DOM).
  • Mouse (2) - Replay of events using the mouse and keyboard simulation.

When to change ReplayType?

Use of ReplayType can be best explained by a below example. In below sample textbox we need to type in any value and see that the button gets enabled when there some text in the textbox and disabled when there is not text. Click on the button will display the values inside the textbox.

Scenario #1

Type in textbox and enable the button:

Now when we record using QTP on this page we would get the below code

Browser("KnowledgeInbox").Page("ReplayType").WebEdit("txtReplayType").Set "KnowledgeInbox"
Browser("KnowledgeInbox").Page("ReplayType").WebButton("Type and enable me").Click

But on replay QTP will throw a “Object is disabled” error as shown in below p_w_picpath

Object is disabled error during replay

QTP throws above error as the ReplayType of the Web Add-in is set to 1 (Events). Let’s look at the HTML code related to the text box

<input onkeyup="EnableThis(this, document.getElementsByName('btnReplayType')[0])" name="txtReplayType" size="20" type="text" />

The input text box has a handler for onkeyup event. Now with ReplayType as 1 (events) QTP just goes and sets the value of textbox which means non of the events get fired. Now there are two possible solutions for the same. We will look at each of them one by one

Solution #1
Firing the handled event manually using FireEvent. In this approach we need to look into the HTML and see which event has a handler and fire the same after changing the value of the textbox

Browser("KnowledgeInbox").Page("ReplayType").WebEdit("txtReplayType").Set "KnowledgeInbox"
Browser("KnowledgeInbox").Page("ReplayType").WebEdit("txtReplayType").FireEvent "onkeyup"
Browser("KnowledgeInbox").Page("ReplayType").WebButton("Type and enable me").Click

Solution #2
Changing ReplayType to 2 (Mouse) will instruct QTP to replay the Set method using Keyboard and mouse simulation. This would simulate a actual user typing into the browser

Setting.WebPackage("ReplayType") = 2 'Mouse
Browser("KnowledgeInbox").Page("ReplayType").WebEdit("txtReplayType").Set "KnowledgeInbox"
Browser("KnowledgeInbox").Page("ReplayType").WebButton("Type and enable me").Click
Setting.WebPackage("ReplayType") = 1 'Events

We saw two of the few possible solutions. Which one should be used then? IMO we should first go for Solution #1 and if that does not work then for Solution #2. The reason behind that opinion is that ReplayType=2 means that your workstation needs unlocked when QTP replays the script.

Scenario #2
I won’t demonstrate the 2nd scenario but would just give overview of the same. For some links which opens popups, when clicked manually popup would open. But when we do the same thing through QTP it IE popup blocker would show a popup blocked message. IE popup blocker is said to be smart enough to determine if a user clicked a link or it was done through code and based on the same the popup is blocked or shown. Changing ReplayType to 2 (Mouse) would simulate a user click and not give the popup bar.

转载于:https://blog.51cto.com/3407162/699184

Web ReplayType?相关推荐

  1. QTP 无法识别web 大全

    说明:这里以一个登陆框为例,展示了各种方式供你选择. 假设你喜欢对象的话.也能够手动加入对象webedit. 依据以上信息,我们就能够玩转web对象了: 1.採用WebElement的描写叙述编程方式 ...

  2. 在k8s中使用gradle构建java web项目镜像Dockerfile

    在k8s中使用gradle构建java web项目镜像Dockerfile FROM gradle:6-jdk8 AS build COPY --chown=gradle:gradle . /home ...

  3. 手动将web项目的class文件打成jar包,手动打jar包,java -cvf,IDE打包底层指令

    手动将web项目的class文件打成jar包. 我们的项目在使用IDE进行编译后,在项目的target目录下将会生成class文件.我们可以将class文件打成jar包. 使用的到命令为: 在targ ...

  4. 将Eclipse中Web项目打成war包

    将Eclipse中Web项目打成war包 请按如下操作即可:

  5. Docker安装Apache与运行简单的web服务——httpd helloworld

    Docker运行简单的web服务--httpd helloworld目录[阅读时间:约5分钟] 一.Docker简介 二.Docker的安装与配置[CentOS环境] 三.Docker运行简单的web ...

  6. 【Golang源码分析】Go Web常用程序包gorilla/mux的使用与源码简析

    目录[阅读时间:约10分钟] 一.概述 二.对比: gorilla/mux与net/http DefaultServeMux 三.简单使用 四.源码简析 1.NewRouter函数 2.HandleF ...

  7. 基于Golang的简单web服务程序开发——CloudGo

    基于Golang的简单web服务程序开发--CloudGo[阅读时间:约10分钟] 一.概述 二.系统环境&项目介绍 1.系统环境 2.项目的任务要求 (1)基本要求 (2)扩展要求 三.具体 ...

  8. CentOS Docker安装配置部署Golang web helloworld

    目录[阅读时间:约5分钟] 一.Docker简介 二.Docker的安装与配置[CentOS环境] 三.Docker部署Golang web helloworld 四.Docker与虚拟机的区别 五. ...

  9. ideal如何创建dynamic web project

    步骤如下 ① file -> new -> project ② 选择 Java Enterprise -> next ③ create project from template - ...

最新文章

  1. post postman 传值_postman参数传递
  2. 在生产中配置和使用AWS EKS
  3. java gc 循环引用_JVM(3)对象A和B循环引用,最后会不会不被GC回收?-------关于Java的GC机制...
  4. Linux批量复制文件夹里的文件到另一个文件夹(问题:linux sh: /bin/cp: Argument list too long )
  5. Flask 框架下 Jinja2 模板引擎高层 API 类——Environment
  6. CUDA的线程层次结构
  7. Modelsim-altera 仿真 顶层原理图的解决办法
  8. Windows的同步I/O和异步I/O
  9. css文本外观属性大全(内附实例与图解)
  10. 把握新航道,CSDN智能汽车技术路线图正式发布
  11. 这五款小众软件你肯定不知道
  12. 网页中加入最新款百度天气预报样式代码
  13. Android 手机控制台灯开关详细教程-智能台灯
  14. LT8618SX中文简介
  15. getaddrinfo getnameinfo
  16. mysql ngram 中文_MySQL 全文检索 ngram插件
  17. 2019最新微专业Python应用基础(11周精通Python计划)
  18. mysql省市级联pid_全国省市级联sql表
  19. 匿名信V1.4.5.1版本更新“数据大屏”功能
  20. Javascript 使用js文件引入其他js文件

热门文章

  1. jQuery框架的简单使用(H5)
  2. linkedlist(c语言_简单实现)
  3. 干货!表达式树解析框架(3)
  4. Fbpanel-轻巧的面板措施
  5. 阿里副总裁肖利华:数智化转型的7个关键词
  6. 大厂没有方法论(上)
  7. 以连咖啡为例丨设计小程序的流量裂变体系
  8. 产品经理如何高效的做用户调研?
  9. Java对于SSL的支持以及证书的安装!
  10. iphone 保存到沙盒中的图片的读取