日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Web ReplayType?

發(fā)布時間:2025/3/20 编程问答 17 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Web ReplayType? 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

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

Web?ReplayType?(Tarun?lalwani)

(2010-01-13 14:46:28) 轉(zhuǎn)載
標(biāo)簽:

雜談

分類: 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.

轉(zhuǎn)載于:https://blog.51cto.com/3407162/699184

總結(jié)

以上是生活随笔為你收集整理的Web ReplayType?的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。