Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need Guidance to Identify Object's Class in QTP
#1
Not Solved
Hi,

I need a quidance in QTP for the following scenario in the project.
I am not aware for it's possibility to do so. If not, guide me for any other procedure to follow.

Scenario:

Application selects the program from the list and based on that program next page ask for an input for various questions of different objects.

Example:

First Time
- - - - - - - - Program I is selected.
- - - - - - - - - - - - -Inputs required for an objects - - - - - - - - - - name in object repository
- - - - - - - - - - - - - - - - - 1. TextBox - - - - - - - - - - - - - - - SC_1-Q_1
- - - - - - - - - - - - - - - - - 2. TextBox - - - - - - - - - - - - - - - SC_1-Q_2
- - - - - - - - - - - - - - - - - 3. CheckBox - - - - - - - - - - - - - - SC_1-Q_3
- - - - - - - - - - - - - - - - - 4. ComboBox - - - - - - - - - - - - - -SC_1-Q_4
- - - - - - - - - - - - - - - - - 5. TexBox - - - - - - - - - - - - - - - SC_1-Q_5

Second Time
- - - - - - - - Program II is selected.
- - - - - - - - - - - - -Inputs required for an objects - - - - - - - - - name in object repository
- - - - - - - - - - - - - - - - - 1. CheckBox - - - - - - - - - - - - - SC_1-Q_1
- - - - - - - - - - - - - - - - - 2. TextBox - - - - - - - - - - - - - - SC_1-Q_2
- - - - - - - - - - - - - - - - - 3. TextBox - - - - - - - - - - - - - - SC_1-Q_3

Note: Object Repository name provided in generic format since I am calling each object inside nested loop.

Here I planned to create reusable functions as flow of the scenario is same and only behaviour at part of the application changes.
I can count the number of inputs to be provided since it is inside a table.
Currently I kept it into the loop (Since my current question carries only textbox - which is apart from above example).

Now I feel that anyhow if I can find which object is appearing for the perticular loop thorugh identifying its class type then dynamically I can set the values.
So can it be possible for me to find out the class type from object name like SC_1-Q_1 or so.

In such case my code at expet view changes as we do for dynamic object name like:
Code:
Browser(...).Page(...).WebEdit("SC_" & scno & "-Q" & qno).set Text


Similar way is it possible for object name like:

Code:
Object = FindOneObjectOfClass {TextBox, CheckBox, ComboBox}

'for first object SC_1-Q_1 and later in loop for other objects too

Code:
If Object is TextBox or CheckBox Then
              Browser(...).Page(...).Object("SC_" & scno & "-Q" & qno).set Text
           Else If Object is ComboBox Then
              Browser(...).Page(...).Object("SC_" & scno & "-Q" & qno).select Text
           End If

In other words, as we can replace Object Name with an Varialbe name, in same fashion can we replace Class Name?
If not any alternative procedure Which I can follow?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  DP Encapsulation Within Class Object TheGlovner 2 1,605 10-12-2018, 02:11 PM
Last Post: TheGlovner
  not able to identify an webelement object Ninjukp 0 2,105 01-10-2018, 09:25 PM
Last Post: Ninjukp
  Not Able to Identify Object during Recovery Scenario Phani 2 3,099 01-25-2016, 01:26 PM
Last Post: arunshuklainbox
  UFT 12.02 Compatibility for IE 11.0 : Fail to identify the defined Object Amruta_121 9 10,487 01-11-2016, 12:45 PM
Last Post: vinod123
  Can not identify this object. Please help. axn700 3 2,962 10-31-2015, 10:59 AM
Last Post: vinod123

Forum Jump:


Users browsing this thread: 1 Guest(s)