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


Messages In This Thread
Creating Objects Dynamically - by Gentoolicious - 07-23-2008, 04:56 AM
RE: Creating Objects Dynamically - by stevol - 07-24-2008, 02:14 PM
RE: Creating Objects Dynamically - by Johny Kluge - 08-18-2008, 05:27 PM
RE: Creating Objects Dynamically - by raghava82 - 08-18-2008, 07:55 PM

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

Forum Jump:


Users browsing this thread: 1 Guest(s)