Today, after being quite tired of switching windows between Notepad++ and QTP, I started experimenting with different layouts I can create to make the the QuickTest editor a little more viewing-friendly. After a few minutes of playing around, I finally have something that I like.
I wanted to share what I have with you guys, and I hope if you have custom layouts for QTP’s editor, please feel free to share them.
The Layout elements can be accessed from the following menu:
Tools -> View Options -> Fonts and Colors
Values for each element to create the layout in the snapshot:
Font name: Courier New Size: 9 Elements: Comment: (Foreground: Green) (Background: White) (Style: Normal) Default: (Foreground: Black) (Background: White) (Style: Normal) Left Margin: (Foreground: Black) (Background: Silver) (Style: Normal) Number: (Foreground: Red) (Background: White) (Style: Bold) Operator: (Foreground: Black) (Background: White) (Style: Bold) Reserved Word: (Foreground: Navy) (Background: White) (Style: Bold) Selected Text: (Foreground: White) (Background: Navy) (Style: Normal) String: (Foreground: Maroon) (Background: White) (Style: Normal)
I should have done this a long time ago :)
{ 15 comments… read them below or add one }
Anshoo,
I have a new question for you.
We all know that Google webpage has a single text box right? Then why is dis code failing?
Browser(“micclass:=Browser”).Page(“micclass:=Page”).WebEdit(“micclass:=WebEdit”).Click
Its giving an error that there are multiple objects matching my description which is not present to the naked eye. So what I did is, I modified the code to:
Browser(“micclass:=Browser”).Page(“micclass:=Page”).WebEdit(“micclass:=WebEdit”,”index:=0″).Highlight
This code doesnt do anything. It simply shifts my mouse focus to Internet Explorer.
But the following code:
Browser(“micclass:=Browser”).Page(“micclass:=Page”).WebEdit(“micclass:=WebEdit”,”index:=1″).Highlight
highlights the search text box in Google page.
Any suggestions?
Pragya
Hi Pragya,
Great question! Actually, there is only one of the WEbEdits that is visible to the human eye. If you examine the HTML Source of the page, or use ChildObjects, you will see that there are actually 2 of them. The reason why you do not see the other is because the developers of Google’s Home Page have made the height property of one of the WebEdits to 0. Since the height is 0, its impossible for the human eye to find it.
You can run the code below to retrieve all the properties of both WebEdits:
Dim oDesc, colObject, x Set oDesc = Description.Create oDesc("micclass").Value = "WebEdit" Set colObject = Browser("title:=Google").Page("micclass:=Page").ChildObjects(oDesc) For x = 0 to colObject.Count - 1 With colObject(x) Print "Class Name: " & .GetROProperty("micclass") Print "abs_x: " & .GetROProperty("abs_x") Print "abs_y: " & .GetROProperty("abs_y") Print "class: " & .GetROProperty("class") Print "default value: " & .GetROProperty("default value") Print "disabled: " & .GetROProperty("disabled") Print "height: " & .GetROProperty("height") Print "html id: " & .GetROProperty("html id") Print "html tag: " & .GetROProperty("html tag") Print "kind: " & .GetROProperty("kind") Print "max length: " & .GetROProperty("max length") Print "name: " & .GetROProperty("name") Print "outerhtml: " & .GetROProperty("outerhtml") Print "x: " & .GetROProperty("x") Print ": " & .GetROProperty("y") Print "-------------------------------------------------" End with NextI hope this helps.
:)
What a great reply :) Thanks Anshoo… because of this 0 height i am not able to see the invisible text box but QTP has found.. Thank you again!!
Thank you! :)
Could you please tell me how exactly can i use the code you have mentioned above to change the font color using descriptive program
ps: i have never used Class
Janavi, this will be done manually through
Tools -> View Options -> Fonts and Colors. No is required code for this :)I had an issue copying a vbbeautifier code to my qtp editor…………after setting fonts and colors i can be able to view well formatted script in my qtp editor
Thankyou for your help
God Bless U
Great!! :)
I generally use Notepad++ and VBSEdit otherwise – both great tools, but VBSEdit offers IntelliSense which can be quite helpful if you have a lot of code in your libraries.
Hey Anshoo,
Ive been trying for quite some time now and still not been able to make my formatting changes persistent on QTP10. Everytime i restart QTP the formatting is reset. Wondering if you have come across this issue.
Vivek,
Yes, I’ve come across this issue with QTP 9.2. It was due to some security setting on the machine which removed all the changes we made during a session. Whenever we restarted the machine, all the changes made in the previous session with all software would be reset.
Great suggestion however, I would change the font to Verdana with size 10. More legible to me.
Thank you so much for this post.
You saved my eyes and brain from atrocious suffering
Anshoo, Thanks for your response, I understand we can edit it manually by navigating to View Options Dialog.
My question is can we do the same using vbscript.. for example we can change the run settings like App.Test.Settings.Run.StartIteration = 1…similarly is there a way change the font settings.
Thanks
I don’t think its possible through AOM.. But, you bring an excellent point. It may be possible through another technique. Research goes on :)
yeh.. actually i got this resolved by gettin my id power user access. thanks for the reply anyways :)