Showing posts with label Display text vertically in message box. Show all posts
Showing posts with label Display text vertically in message box. Show all posts

Tuesday, August 2, 2011

How to display a string(say for example "Quick Test Professional") vertically in a message box?

Dim MyString, MyVar, i, S

MyString="Quick Test Professional"

For i=1 to Len(MyString)

'Get a new character for each iteration into S

S=Mid(MyString, i, 1)

'Add a character to MyVar and then add a new line. VBCRLF stands for Visual Basic Carriage Return Line Feed

MyVar=MyVar & S & VbCrlf

Next

Msgbox MyVar


Monday, July 25, 2011

QTP - Question and Answers - 1

1.  What are the differences between function and action?



Note: It depends on the comfortably/requirement for any person to decide which one is better among Action Vs Function.

2. How can you scroll down or up in a page using QTP?

There are couple of ways for doing this.

'For page up
Set Obj=Browser("browsername").Page("pagename").Object.body
Obj.doScroll("pageUp")

'For page down
Set Obj=Browser("browsername").Page("pagename").Object.body
Obj.doScroll("pageDown")

Or you can also the following Send Keys method:
'For page up
Set objShell=CreateObject("WScript.Shell")
objShell.SendKeys "{PGUP}"

'For page down
Set objShell=CreateObject("WScript.Shell")
objShell.SendKeys "{PGDN}"