Introduction
In this article, we will cover the basics of Description Object and the ChildObjects method. This is a very powerful approach to creating robust automation test suites. It is also a very important principle of Descriptive Programming in QTP.
We will see how we can create an object description with a single property, with multiple properties, by using regular expressions and finally putting all these concepts into their application with the ChildObjects method.
Before we see how it is done, we must first understand the following statement:
Set oDesc = Description.Create
Above, we are using the variable oDesc to create a description of something. Since, oDesc is preceeded by a Set statement, it must be an object reference. Therefore, when the above statement executes, oDesc will become an object reference to a description object. We will use the description object with the ChildObjects method to retrieve object collections. These object collections are nothing but arrays of objects with the exact properties of the description object.
If you are starting with DP, please read the article on Descriptive Programming Concepts on Relevant Codes for a quick walk-through on Descriptive Programming before continuing with this article.
I. Creating a Description Object for a Parent (Browser/Window)
To create an object description for a parent, we will simply use the “Class” of the parent object and add the property-value combination:
Dim oDesc 'Description Object Dim colObject 'Object Collection Set oDesc = Description.Create 'Remember to always use 'micclass' and not 'class name' oDesc( "micclass" ).value = "Browser" 'We used Desktop as the parent here because, the Desktop Object holds all the Windows Set colObject = Desktop.ChildObjects( oDesc )
When the above snippet execute, colObject will contain a collection of all browsers visible on the desktop.
But, since we have done this, how will we know how many browser objects exist on the desktop through code? Also, how will we retrieve their information? The answer is quite simple: colObject contains the necessary information and methods we can use to perform events on our target objects.
'Retrieve # of open browsers MsgBox colObject.Count 'Retrieve Titles of all open browsers For x = 0 to colObject.Count - 1 MsgBox colObject(x).GetROProperty("title") Next
As I mentioned above, colObject is nothing but an array of all objects having the exact same properties as the description object. Therefore, colObject(0) points to the first object in the collection, colObject(1) points to the second object in the collection, and so on. This is demonstrated in the For..Next loop in the snippet above.
II. Creating a Description Object for an Object contained in a Browser/Window
Using the same approach above, we will retrieve collection of all Link objects on a page. Notice here that instead of Desktop, we have used the entire Browser-Page hierarchy. This is because, a link object is present somewhere inside the Page, instead of the desktop :).
Dim oDesc 'Description Object Dim colObject 'Object Collection Set oDesc = Description.Create oDesc( "micclass" ).value = "Link" 'Using the entire Browser-Page hierarchy Set colObject = Browser( "title:=Google").Page("title:=Google").ChildObjects( oDesc )
By executing the snippet above, we will use colObject to perform some events on these objects. Let’s retrieve the number of link objects present in our browser:
'Returns 30 MsgBox colObject.Count
The above example is created for the Google page, and if you want to test it for some other browser, do not forget to change the Browser and Page titles to the correct values.
III. Creating a Description Object for an Object contained in a Browser/Window Using Multiple Properties
If you saw the above example, we created a description object using only the class of the Link object. Now, we will retrieve a more specific object collection. We are going to specify an additional property and narrow down the search results- this is because, even though there can be multiple Link objects on a page, its not necessary that there would be the same number of objects with the text “Hello, I am a Link!”.
This approach helps us retrieve only the objects that we really want for our automation, since having a collection of all objects can be quite cumbersome to work with. Also, if we provide relevant information to our Description Object, QTP will return a narrowed-down collection, which is the easiest to work with. This is similar to how you search Google. If you specify “QTP” in Google Search, you will have a huge array of search results. You can narrow down the search results (and find information faster) if you add “QTP + Browser + DP” instead.
Dim oDesc 'Description Object Dim colObject 'Object Collection Set oDesc = Description.Create oDesc( "micclass" ).value = "Link" 'Additional property- for more focused and controlled collection oDesc( "text" ).value = "Images" Set colObject = Browser( "title:=Google").Page("title:=Google").ChildObjects( oDesc ) Msgbox colObject.Count 'Returns 1
Now, colObject will only contain the Link objects that have the text: Images. Also, if you notice Google page, there is only one link with the Images text. This is a good example of finding the target object dynamically. Suppose, if there were 2 links on the page instead, we would have both of them in our collection colObject. Let’s highlight our found object:
colObject(0).Highlight
Executing the statement above, we will highlight the first object in the collection. I know there is only one object in the collection, but we can make sure by doing this:
For x = 0 to colObject.Count - 1 colObject(x).Highlight Next
IV. Creating a Description Object using WildCards
If we have dynamic objects in our application, then we may not always have the luxury to feed their properties as we have done in the example above. Sometimes, we would need to create dynamic descriptions and retrieve our target objects from resulting (dynamic) collections. I say dynamic collections because at one time, your collection may hold 9 objects, whereas during the next session, it may hold 10.
Dim oDesc 'Description Object Dim colObject 'Object Collection Set oDesc = Description.Create oDesc( "micclass" ).value = "Link" oDesc( "text" ).value = "I.*age.*" 'Images '.regularExpression is 'True' by default oDesc( "text" ).regularExpression = True Set colObject = Browser( "title:=Google").Page("title:=Google").ChildObjects( oDesc )
You may want to read the article on Regular Expressions to better understand how these work in Descriptive Programming.
After executing the snippet above, we will have a collection object with all object that match the regular expression. Let’s see the count of the objects:
'Returns 1 because our supplied pattern only matches with the word: Images MsgBox colObject.Count
Let’s replace the “text” with “ma” instead and see if we still retrieve a collection with a single object:
Dim oDesc 'Description Object Dim colObject 'Object Collection Set oDesc = Description.Create oDesc( "micclass" ).value = "Link" oDesc( "text" ).value = ".*ma.*" 'Images '.regularExpression is 'True' by default oDesc( "text" ).regularExpression = True Set colObject = Browser( "title:=Google").Page("title:=Google").ChildObjects( oDesc )
To see what has changed, let’s execute the following:
'Will return 4 MsgBox colObject.Count
If you do execute the snippet above, the count would be 4. Why is that? To see the new objects in our collection, let’s do this:
For x = 0 to colObject.Count - 1 MsgBox "x:" & x & " || " & colObject(x).GetROProperty("innertext") Next
Below are our outputs:
Interesting, isn’t it? Our description for the text property matched all links that had the letters ma in them.
V. Negating WildCards
Sometimes we have an object description with wildcards in it. Here, we want to turn off the Description Object’s ability to register the description as a regular expression. This is quite simple, and we do it by turning regular expression as False:
Dim oDesc 'Description Object Dim colObject 'Object Collection Set oDesc = Description.Create oDesc( "micclass" ).value = "Link" oDesc( "text" ).value = ".*ma.*" 'Images oDesc( "text" ).regularExpression = False Set colObject = Browser( "title:=Google").Page("title:=Google").ChildObjects( oDesc ) MsgBox colObject.Count 'Returns 0
Now, the above snippet will not identify Images or Maps. Instead, it will only identify objects that have the exact text .*ma.* which really doesn’t exist anywhere on the Google homepage.
VI. Creating a Description Object for Integer-Types
So far, we have only learned various ways to work with description objects using Strings. Here, we will see how they transform into integer-types. Let’s bring up the properties of the Images link again using the Object spy and feed its “x” coordinate to see whether we can find the link:
Dim oDesc 'Description Object Dim colObject 'Object Collection Set oDesc = Description.Create oDesc( "micclass" ).value = "Link" oDesc( "x" ).value = 51 'It should always be 51, not "51". Set colObject = Browser( "title:=Google").Page("title:=Google").ChildObjects( oDesc ) 'Will return 1 MsgBox colObject.Count 'Will return Images For x = 0 to colObject.Count - 1 MsgBox colObject(x).GetROProperty("innertext") Next
Notice that 51 above is not within quotation marks. This should always be the case. Notice when we replace it with a string-type below:
Dim oDesc 'Description Object Dim colObject 'Object Collection Set oDesc = Description.Create oDesc( "micclass" ).value = "Link" oDesc( "x" ).value = "51" Set colObject = Browser( "title:=Google").Page("title:=Google").ChildObjects( oDesc ) MsgBox colObject.Count For x = 0 to colObject.Count - 1 MsgBox colObject(x).GetROProperty("innertext") Next
The collection is an empty one:
So, always remember to treat integers as they are. This always holds true for x, y, abs_x, abs_y.
VII. Building Object hierarchy with ChildObjects
We will use the Browser Object Collection to set a value in a text box to demonstrate this:
Dim oDesc 'Description Object Dim colObject 'Object Collection Set oDesc = Description.Create oDesc( "micclass" ).value = "Browser" oDesc( "title" ).value = "Google" 'Notice we used the Desktop Object again for retrieving Window collection Set colObject = Desktop.ChildObjects( oDesc ) 'Retrieve the count iCount = colObject.Count 'Set value in the WebEdit of the last Window object in the collection For x = 0 to iCount - 1 'Verify if the Browser title equals "Google" If Browser("creationtime:=" & x).GetROProperty("title") = "Google" Then 'Set Description.Create in the search TextBox Browser("creationtime:="&x).Page("micclass:=Page").WebEdit("name:=q").Set "Description.Create" End If Next
When the above snippet executes, we will have the following value set in the Search TextBox in Google HomePage:
I hope this article will help you guys understand the concepts of one of the most important concepts in Descriptive Programming: the Description Object. Thanks for visiting Relevant Codes :)
If you have any questions, please ask them in the comments section. If your information is to be treated as confidential, please use the Contact Form to send me an e-mail instead.

{ 60 comments… read them below or add one }
Hi Anshoo,
The Description object article is very clear with examples.keep up the good work
Regards
Suni
Hi Sunitha,
Can you please send some web based exercises to work on. I am a beginner in QTP. My mail id is charles.vimala@gmail.com.
Thanks,
Charles.
Thanks! :)
Hello Anshoo,
Can you please tell me the difference between vbcr and vbcrlf vbscript constants? In the help file, its mentioned that vbcr gives a carriage return which according to me is Enter key in our keyword and vbcrlf does the same plus it adds linefeed. now what is this linefeed? I have already got the enter command through vbcr so why vbcrlf? Also vbNewline is there?
Regards,
Sangeetha
Hi Sangeetha,
Great question, and to be honest with you, I never use vbCr. However, you raise a good question and to answer it, I am going to recommend you to read the following article: NewLine. It will explain what each means and how they came about.
A linefeed is quite an interesting concept, but before I explain that, I must explain what a carriage does. A carriage just moves one line down from the point where the method is executed. A linefeed enables the cursor to move to the far-left, where you would want it to be, and that’s ideal/common.
vbCrLf resembles that and its easier for beginners to understand what it does. So, even though it does the same thing, its quite easy to comprehend what it would do without much thought.
vbNewLine on the other hand, and I am not too sure here, but I think its platform dependent and it may signify different things in different environments. This is all MSDN says about it: vbNewLine.
Hi,
Can you help me in QTP by providing some practical exercises. I am a beginner. My mailid is charles.vimala@gmail.com.
Thanks,
Charles.
Hi Sangeetha,
Can you please send some good practical exercises on QTP. I am a beginner. My mailid is charles.vimala@gmail.com
Thanks,
Charles.
Hello Anshoo,
Can you please tell me that in the case of array, which approach is better to loop thru the items: For Each loop or a normal for loop? or either can be used?
Also why do LBound and UBound function works fine with the arrays created using Array keyword and not with the arrays declared like Dim A(3). I see that UBound(arr) gives a different answer in these cases.. Can you please explain me why?
Hi Pragya,
I rarely use For..Each Loops. I find it easier and more efficient working with the normal For..Next Loop (you can directly access the element number without using an explicit counter which you would in For..Each). I have also noticed on several occassions that there is a slight performance drop when using For..Each loops. To illustrate, let’s see the example below:
Dim arrArray: ReDim arrArray(9) Dim tStart, x, Element arrArray = Array("a", "b", "c", "d", "e", "f", _ "g", "h", "i", "j") tStart = Timer For Each Element in arrArray Print Element Next Print "For Each: " & Timer - tStart 'I can directly use "x" here 'With For..Each, I would have to use an increment to know which element I am working with tStart = Timer For x = LBound(arrArray) to UBound(arrArray) Print arrArray(x) Next Print "For Next: " & Timer - tStartWhich one gives a better time?
Using the same array above, when I execute the following line, I get 9:
In your case, when you do UBound(A), you should get 3. It should return 3.. Can you please share with me your result as well?
Hi,
Can you explain with the example that what are child object, How should we get this from parent object and where
should we use this?
Thanks,
Alkaa,
Your question can emcompass an entire topic – its that vast. However, to give you a quick idea of how and where we use ChildObjects, let me walk you through a simple scenario:
Suppose you have n number of CheckBoxes on a page, and this number changes depending on your inputs on previous screens. The requirement is to enable them all regardless of the number of CheckBoxes. So, let’s say for Process 1, there are 20 Checkboxes on the page, but for Process 2, this number increases to 40.
This is where ChildObjects can be used, and makes work extremely easy. Since ChildObjects retrieves object collections, we can use it to enable all the CheckBoxes easily. In your library, this is all the code you would have to keep to enable them all:
'Creating a description object for a WebCheckBox Set oCheckBox = Description.Create oCheckBox("micclass").value = "WebCheckBox" 'Object Collection Set colObject = Browser("").Page("").ChildObjects(oCheckBox) 'Looping through the collection and enabling all CheckBoxes For x = 0 to colObject.Count - 1 colObject(x).Set "ON" NextI hope this helps.. If you’re still unclear, we can create a working example too.
Anshoo,
You gave me a good initiative idea about child object. I am understanding from different angles. Kindly clarify my one more issue that….can we use micClass universally in descriptive programing everywhere like with browser, page, text and combo or it is specified only for Browsers? I explored alot but could not get any satisfactory answer. I have big tumor of confusion and questions from long time. Therefore kindly reply.
thanks in advance..
Yes, the micclass identifier can be used with any object, regardless of the application and technology. micclass equals Class Name in Object Spy. Each Object, regardless of the properties it has, also has a class-type identifier, which is defined by micclass.
However, even though each object can be identified using its micclass identifier, you must note that it may not be sufficient to uniquely identify an object. For example, open 2 browsers and execute the following code:
Browser("micclass:=Browser").HighlightIt will result in an error. That is because even though the Class Name was used, it is not enough to identify the correct browser between the 2 open browsers. Thus, you will have to add other properties to make the distinction between the two. Obviously, this would result in the same behavior if there were multiple objects of any class. We would need to use additional properties to identify them uniquely, and using micclass alone will not help.
Good Explaination with examples ,thank you
Glad it helped! :)
Hey there,
I believe my question is related as it deals with child objects. Anyhow here’s my problem.
I’m having a bit of trouble identifying WebEdit objects on a web app I’m testing. The problem is the input box themselves don’t have id’s and the class associated with each is not unique. Also the ordering of them may be different depending on other variables so I cannot use their indexes. However, each input box is a child of a div that does have a unique id. I can’t figure out how to set the value in the input box.
The HTML structure is as follows:
and the following qtp snippet spits out the innerhtml of the first input box:
Browser("").Page("").Frame("").WebElement("html tag:=DIV", "html id:=unique_id_1").GetROProperty("innerhtml")Is there anyway to take that output and cast it to a WebEdit object?
Thanks for any help,
Jason
Jason,
You can wrap your code around:
p r e
/ p r e
(without spaces)
Sorry, I thought the ‘code’ tags would display the HTML structure.. guess not. Let’s try with ‘pre’ tags:
and if that didn’t work:
Hi Jason,
You can try the following:
With Browser("Browser").Page("micclass:=Page") .WebElement("html id:=unique_id_1").WebEdit("class:=non_unique_class").Set "1" .WebElement("html id:=unique_id_2").WebEdit("class:=non_unique_class").Set "2" End Withor:
With Browser("Browser").Page("micclass:=Page") .WebElement("html tag:=DIV", "html id:=unique_id_1").WebEdit("index:=").Set "1" .WebElement("html tag:=DIV", "html id:=unique_id_2").WebEdit("index:=").Set "2" End Withexcellent info, If you have more things to I would very much aprreciate it.
Thanks, Sam. I will try to post a few more such articles in the coming weeks!
Hi,
I have one problem in passing a value to a link object.
I have set of links in a folder frame .. for ex: Test1,Test2,Test3,Test4 .. etc.
While recording, i had selected Test1 link in the folder frame. Test1 has been added to the object repository as a test object.
Test1,Test2,Test3,Test4 are the objects of the class Link.
Now if i want to select Test2 by running the same script .. how?
For that i used msgbox function to allow the user to enter the value of the link.
I got the list of link objects in the folderframe object and i created a loop to check whether the value entered by the user is equal to the value of the link (got it by using child objects method).
Whenever the value entered by the user and the link got it from the application are same, i am trying to pass that value to the link method as mentione below:
Browser(“Login”).Page(“Application”).Frame(“folderFrame”).Link(“Classification”).Click
Classification is the value which is entered by the user.
Let us say user wants to select Link Test2 where as Link Test1 has been selected while recording.
When i execute the above mentioned statement, instead of selecting link Test2, it is selecting Test1(which was selected while recording).
Pls help me in this .. if you are not able to understand, feel free to mail me @ nbabu11@gmail.com
Hi Babu,
If you’re using DP:
For ix = 1 to 4 Browser("Login").Page("Application").Frame("folderFrame").Link("innertext:=Link" & ix).Click NextIf you’re using OR:
For ix = 1 to 4 Browser("Login").Page("Application").Frame("folderFrame").Link("Link" & ix).Click NextHow would you go about only grabbing children that ONLY have numbers in their “innertext”?
Here is what I have so far:
———————————————————————————————————————————————————————
Dim oDesc ‘Description Object
Dim colObject ‘Object Collection
‘Filter web child objects to get only the child under “Account Number”
Set oDesc = Description.Create
oDesc(“micclass”).Value = “Link”
oDesc(“html tag”).Value = “A”
oDesc(“height”).Value = 13
Set colObject = Browser(“micClass:=Browser”).Page(“micClass:=Page”).ChildObjects( oDesc )
‘Retrieve the count
iCount = colObject.Count
————————————————————————————————————————————–
It is returning back 8 children. But I only want to retrieve one child. The other seven children have letters in their “innertext” and teh one child I want only has numbers.
Thanks,
Steve
Hi Steve,
For a description object to incorporate only numeric values, the following ReGex would be applicable to the object’s innertext:
Set oDesc = Description.Create oDesc("micclass").Value = "Link" oDesc("innertext").Value = "\d+"Thanks much Anshoo!
Steve
:)
Your examples are truly useful but I got one question:
If I wanted to use a Description Object to identify certain type of objects on my app screen, but I want to exclude objects, say for example, that have a property with a specific value.
How could I handle this?
Something like:
Set oDesc = Description.Create
oDesc(“micclass”).Value = “Link”
oDesc(“html tag”).Value = “A”
oDesc(“height”).Value 13
That would return Links with html tag = “A” but exclude those links with value = 13.
Thanks!
Hi Israel,
I don’t think this is possible, and you can verify this through Object Repository as well. With constants in such situations, regular expressions are not allowed so I’m not sure how we can create such a description object. I think the only feasible way at present is by using (and negating) objects in the collection through a loop:
For ix = 0 to iCount - 1 If colObject(ix).GetROProperty("height") = 13 Then SkipStep NextHey!
Thanks for the quick response!
You are right, but I was thinking that maybe regular expressions could help (^) to retrieve objects with a property different than a specific value.
Regards,
ReGex is possible, but only for some properties. This is a limitation that has become more prominent as people have sought advanced use of the description object. I hope HP will someday address this..
thanks
Hi Anshoo,
Just want to know, if I want to create the description only once and want to use that description in all the tests. How can I do that. Because if there are many tests and I am using descriptive programming then it is becoming a problem. Can you provide some guidance. Is there any possibility to do that using function? if yes, how? Plesae provide some examples.
Thanks in Advance
San
Hi San,
If you would like to only create the Description Object without any properties, you can do it through a function call:
Function DescObject() Set DescObject = Description.Create End FunctionIf the same needs to be done with addition of properties, you can do this:
Function DescObject(sProperty, sValue) Dim oDesc : Set oDesc = Description.Create oDesc(sProperty).Value = sValue Set DescObject = oDesc End Function 'Usage: Set oDesc = DescObject("micclass", "Browser") MsgBox Desktop.ChildObjects(oDesc).CountThe above function can certainly be extended for more properties and values. I hope this helps :)
Hi Anshoo,
Thanks for the reply, but I think, using this I can only get the value of one object only.
But if I want to create and use the description of multiple objects with more properties, how can I do that.
Please elaborate
Thanks
I mean, I just want to create a function which only contains the description of all the objects, which I want to use my complete test project like an Object Repository.
You’re correct. The above approach will allow you to create a single Description Object, and this is also the technique I would recommend. It’s always easier and more descriptive when you’re assigning a new object reference through a function call, and easier understood by another member of your team.
Example:
Dim DescriptionDict Set DescriptionDict = CreateObject("Scripting.Dictionary") With DescriptionDict .Add "SearchTextBox", "html tag:=Input||name:=q" .Add "SearchButton", "value:=Google Search" End With 'Your code to form the descriptions Set DescriptionDict = NothingComplete solution:
Set dicDescription = CreateObject("Scripting.Dictionary") With dicDescription .Add "SearchTextBox", "html tag:=Input||name:=q" .Add "SearchButton", "value:=Google Search" End With Keys = dicDescription.Keys Items = dicDescription.Items For ix = 0 to dicDescription.Count - 1 Execute "Set " & Keys(ix) & " = Description.Create" arrArray = Split(Items(ix), "||") For Each Desc in arrArray Execute Keys(ix) & "(" & Chr(34) & Split(Desc, ":=")(0) & Chr(34) & ").Value = " & Chr(34) & Split(Desc, ":=")(1) & Chr(34) Next Next 'Description Object: SearchTextBox Print SearchTextBox("html tag") 'Description Object: SearchButton Print SearchButton("value") Set dicDescription = NothingI got it,,,
Thank you
Hi,
I am using the following code to get child objects:
set EditDesc = Description.Create() EditDesc("automationclassname").Value = "FlexList" Set m_Child = m_target.ChildObjects(EditDesc) msgbox m_Child.Countbut it give me the count of all child items instead of only “FlexList” objects.
I can get the FlexList objects in the collection but why its not working with description.
Can anybody help me out where i am wrong????
Devender, try this:
Set EditDesc = Description.Create EditDesc("micclass").Value = "FlexList" Set m_Child = m_Target.ChildObjects(EditDesc) MsgBox m_Child.CountHi Anshoo,
thanx for the reply.
But i tried this also, still its giving me all the child objects instead of FlexList objects.
What is
m_target?Please see this article as well which is written by the same folks who develop Flex. You may find some techniques in that helpful. I haven’t had a chance to work with Flex, and tried to inquire about this issue from colleagues but I feel that that there is a very very small user-group that is currently automation Flex apps. I know this doesn’t solve your problem, but can you try to post this issue on HP’s forums? Maybe someone there might be able to help. I searched OpenView as well, but there are no documents pertaining to this issue.
If nothing seems to work, you can post in this thread and seek Roi’s help.. He works for HP and may be able to provide a better understanding of this scenario..
Hi San,
May be Environment variable helps you out to store the collection and retreive in-between the tests.
Anshoo, I am using QTP 9.1
And the problem is that QTP is not able to recognize/identify the devX components like grid, dropdowns, checkboxes etc.
It is recognizing these as IMAGES. And I came to know that it is possible using DotNetFactory feature, but I don’t know how to implement that. Can you please provide some light on this.
Thanx
What add-in is it, San? .NET?
No, there is no add-in
Is that required…?
It will be required depending upon the technology of your application. Without the correct add-in, you won’t be able to successfully automate it..
Its very nice article for the beginners…
Thank you Neelakanthan, I’m glad it helped :)
Hi
I have the following 2 questions:
* Is it possible to automate siebel 8.1 using QTP ?
* Is there a way to retrieve all the Parent objects , given the name and type of child object?
Regards,
Pavi
#1. Yes, its possible to automate Siebel 8.1 with QTP. I am currently working with Siebel 8.1 and QTP works quite well; a little slow, but manageable :)
#2. Not sure what you mean? Why would you like to do something like this, especially since its the Child Objects that change and are really dynamic in nature?
Hi, Anshoo,
I cannot use ChildObjects for finding a WebElement. Following is the example
For example, we have a html:
I prepare to use the following script for identify the text named “DP is cool!”.
Set objDesc= Description.Create() objDesc ("micclass").value = "WebElement" 'objDesc ("html tag").value = "B" objDesc ("innertext").value = "DP is cool!" Set testPage = Browser("name:=WebTest").Page("title:=WebTest") set objTesting = testPage.ChildObjects(objDesc) msgbox objTesting.countThe result always be zero. That means QTP cannot find it. Why?
Maybe I can use the
.Object.getElementsByTagNameto find it, but I still wonder to know why I cannot find it by the above method.Do you have any idea?
Thank you very much in advance.
Regards,
Dennis
Dennis,
Remember to use the “\” backslash for the ReGex meta-character:
Set objDesc= Description.Create() objDesc ("micclass").value = "WebElement" objDesc ("html tag").value = "B" objDesc ("innertext").value = "DP is cool\!" Set testPage = Browser("creationtime:=0").Page("micclass:=Page") set objTesting = testPage.ChildObjects(objDesc) MsgBox objTesting.Count 'Gives 1Hi, Anshoo,
Oh! I got it! Thank you very much. I think I’ve understood the reason.
It seems I also can do as follow:
objDesc ("innertext").RegularExpression = falseThanks again. :)
Regards,
Dennis
Yes! You can also disable ReGex for the object description. Glad its working now.
It seems this blog will parse the html tag automatically even I include it in “pre” tag.
It should be
[html][title]WebTest[/title][body][b]DP is cool![/b][/body][/html]Hi ,
Can anyone please help me out with How to maximize browser in Virtual machine.
I tried with Window().maximize … It works on the local machine .. but not on Virtual..
Also tried with hwnd property … But it never seems to work.
Please help me out.
Ranjana,
Try this:
Const SW_MAXIMIZE = 3 Extern.Declare micLong, "ShowWindow", "user32.dll", "ShowWindow", micHwnd, micLong HWND = Window("").GetROProperty("hwnd") Extern.ShowWindow HWND, SW_MAXIMIZEHi Anshoo,
What is the typical entry and exit criteria for automation testing in a project?
Vk,
It depends. Entry and Exit criteria are generally defined based upon the scope of the project and the way you have created automation.
For example, consider a function that logs in a User based upon given UserName and Password strings. An Entry criteria for this function would be if the function has found the correct page. If the correct page has been found, it can proceed to log in the user. Exit criteria would be if the page the function is on is incorrect – this will automatically throw an exception and end the function.
{ 1 trackback }