Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Creating Objects Dynamically
#1
Not Solved
One of my tests is designed to create a user and then check to make sure the user actually exists.

When a user wants to log in they are displayed a list of buttons that have the account name and account picture displayed (imagine logging into Windows XP) where the account name is the name of the button.

My script does something like this:

Code:
Dim accountName
Randomize
accountName = DataTable("accountName", dtGlobalSheet) & int((99999*rnd)+1)


'Process to Register Account
WpfWindow("WindowName").WpfEdit("UserName").Set accountName

<snip>

'Process to Login
if WpfWindow("Window Name").WpfButton(accountName).Exists Then
  MsgBox("Test Succeded.")
Else
  MsgBox("Test Failed.")
Endif

So as you can see, the accountName variable is generated somewhat randomly and, at the end of the script, the variable accountName is just substituted for the button name.

The code works. The problem is that QTP checks to see of WpfButton(accountName) exists in the object repository. As the button did not exist before the start of the test, it will not exist in the object repository and QTP throws an error message causing all my tests to report as failed (when they're not failing).

Can anyone tell me if their is some way to dynamically create an object and then add it to the repository while a script is running?
Reply
#2
Not Solved
Hi,
you must use descriptive programming, without using object repository.
With object spy you discover unique properties of WpfButton and you arrive to write something similar to:

Code:
If WpfWindow("Window Name").WpfButton("property_xyz:=xyz").Exist ...
Reply
#3
Not Solved
Hi,

I have got little bit another problem:
My script fills in the form on Terminal Emulator window. Before this window appears, unique ID is generated and displayed in the header of the form. I can capture this ID and store it into Output Value.
I need to check the Sybase DB if there is a new record added with such a new ID (after submitting the terminal form).
I was trying to insert a DB check, but it only works with static data.

I need to execute a select from table and check wheter new ID is present in the DB table.

Is it neccessary to configure the Object Repository? How?
Any help/link/comment would be very welcome!


Thank you
J.
Reply
#4
Not Solved
Hi Gentoolicious !

This is Raghava, I have not clearly understand ur problem, but i give the on suggetion to u, after recording you can change the name of that filed into Regular Experiession then while running the Test it will not take care about the particular Name, so i hope that i will not through any error.
Once Try this method.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  UFT issues with Outsystems dynamically generated Id/names jherron 2 1,363 03-02-2020, 09:33 PM
Last Post: Swishy70
  Unable to capture value of Webelement which is changing dynamically sheetal 9 16,237 02-16-2018, 11:01 AM
Last Post: janki_kakadia
  Unable to click on dynamically changing webelement preeti 0 1,817 04-29-2017, 08:50 PM
Last Post: preeti
  Adding data into rows that add dynamically with setcelldata azar81 4 5,936 04-13-2015, 05:24 PM
Last Post: vidya2k2
  Creating Random String SomeIntern 0 5,081 08-21-2013, 09:10 PM
Last Post: SomeIntern

Forum Jump:


Users browsing this thread: 4 Guest(s)