Thursday, May 30, 2013

QTP tricks


----------------------------------------------------------------------------------------------

The ASCII codes for a line is Chr(10)

arrlines = Split(c, chr(10), -1, 1)

Ref: http://www.joecolantonio.com/2011/07/26/qtp-ascii-chr-code-chart/

----------------------------------------------------------------------------------------------
Sendkeys:

 ALT+F4 :-
Set WshShell = CreateObject("WScript.Shell")
WshShell.SendKeys "%f"

Ref: http://www.quicklearnqtp.com/2010/05/sendkeys-method-in-qtp.html
----------------------------------------------------------------------------------------------

popupExist = SubmitPopUp().Object.currentStyle.display 'Verifying if submit pop-up is displayed or not.

If popupExist = "block" Then 'Verifying is submit pop-up is displayed.
   Print "Submit POP UP exist."

Ref: http://testeverythingqtp.blogspot.com/2012/01/qtp-object-is-visible-or-not-on-web.html

----------------------------------------------------------------------------------------------
Example for getvisibletext:

c = Browser("RemoteCapture").Page("RemoteCapture").WinObject("tblScanRecords").GetVisibleText

Print c

----------------------------------------------------------------------------------------------

Print vbcrlf 'Add new empty line.
----------------------------------------------------------------------------------------------

QTP device replay:-

The Device Replay feature is used to perform mouse and keyboard actions against screen coordinates that are provided. The Device Replay functions are not automatically recorded, but must be programmed manually in the Expert View.

Set DeviceReplay = CreateObject("Mercury.DeviceReplay")

DeviceReplay.MouseMove 290, 70

DeviceReplay.MouseClick 290, 70,LEFT_MOUSE_BUTTON
wait 2
Set DeviceReplay = Nothing


Ref: http://www.unlimitedqtp.com/2012/10/mercury-device-replay.html
----------------------------------------------------------------------------------------------

No comments:

Post a Comment