How to handle Dynamic Objects with OpKey?

211 views

Published on

How to handle Dynamic Objects with OpKey?

Published in: Technology, Art & Photos
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
211
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
5
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

How to handle Dynamic Objects with OpKey?

  1. 1. How to handle Dynamic Objects with OpKey ? While automatingawebapplication,quite often youmighthave experiencedfailureof yourtestcases duringtheirexecutiondue to changedpropertiesof dynamicobjectsfetchedinyourObject Repository. These dynamicobjectsoftenchange theirpropertiessuchasname, id,value etc. To handle these dynamicobjects,youcanuse ‘Is Regex’feature The followingillustrationwill explainaboutdynamicobjects andthe usage of ‘Regex’.Here I’musinga website inwhichthe name propertyof ‘Name’editbox usuallychangeswheneverIlaunchthatpage again,whichmeansmytest casesforthis page wouldfail due tothose changes.So,I will be using ‘IsRegex’which will handle the changesin the name propertysothatmy testcasesdon’tget affected. In the followingscreenshot,while fetchingthe objects of awebsite,Igotthe followingproperties Screen shot 1
  2. 2. The above ‘Screen shot 1’ shows the window of ‘Import from Application’ where I’ve fetched the ‘Name’ text field. Properties are shown in the following screen shot Screen shot 2 In above screen shot you can see the Object Properties, in the ‘name’ field value is as ‘ctl00$ContentPane$ctl00$Name55’.
  3. 3. Now if I again fetch the properties of ‘Name’ edit box of that webpage, I will get the following properties Screen shot 3 In above screen shot you can see the Object Properties, in the ‘name’ field value is as ‘ctl00$ContentPane$ctl00$Name87’. Similarly if I fetch again the properties of ‘Name’ edit box of that webpage, ‘name’ field value is ‘ctl00$ContentPane$ctl00$Name90’. This clearly implies that during execution of my test cases, the ‘name’ field value will change again. Now, to handle these changes I will use ‘Is Regex’ which will handle the above changes.
  4. 4. Now, after fetching the object, now observe the following screenshot Screen shot 4 Screen shot 5 The above screen shot 3 shows the view of Object Repository window and screen shot 4 shows the view of ‘Properties’. In screen shot 4 you can also see ‘Is Regex’. Now, in my case the ‘name’ field value are as ‘ctl00$ContentPane$ctl00$Name55’ ‘ctl00$ContentPane$ctl00$Name87’, ctl00$ContentPane$ctl00$Name90’. On observing these field values you will observe only last two values are changing else everything is same.
  5. 5. So, I will rename the value of name in ‘Properties Window’ as ‘ctl00$ContentPane$ctl00$Name’ and I will check the checkbox corresponding to the name property. Following screen shot will make it clearer to you Screen shot 6 In the above screen shot 6, I have changed the value of ‘name’ to ‘ctl00$ContentPane$ctl00$Name’ and I’ve checked the checkbox under ‘Is Regex’ corresponding to the name property. Now you can save your files and execute your test cases.

×