SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 8 of 8
  1. #1
    Junior Member
    Join Date
    Jul 2004
    Location
    CO
    Posts
    7
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    What to do with changing window name...

    I am trying to write a generic test that will perform a prodedure. However, every iteration of this procedure that is done, the name of one of the windows involved in the procedure changes when a number that is generated is inserted into the window name and therefore the code that QTP generates when recording a test will not work properly.

    Is there a way to call this window generically? The window is in focus when i want to perform an operation on it so it is on top...i just can't figure out how to call it in the code without using the exact name.

    </font><blockquote><font size="1" face="Verdana, Arial, Helvetica">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;"> Window(&quot;Application&quot.Window(&quot;Window Name&quot.WinEdit(&quot;Edit&quot </pre><hr /></blockquote><font size="2" face="Verdana, Arial, Helvetica">How would i modify that code to do what i want?

    Any ideas?? This is probably an easy solution and i just do not know enough VB yet to figure it out...

    Thanks!

  2. #2
    Senior Member
    Join Date
    Jan 2000
    Location
    USA, CA
    Posts
    1,998
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: What to do with changing window name...

    Is this fragment was recorded by QTP?
    I thing something wrong: 2 Window objects...
    Why 2 ?
    =======
    You can identify this window by index.
    Look with ObjectSpy, how QTP understands this object, and use this property.
    Regards
    Janna

  3. #3
    Junior Member
    Join Date
    Jul 2004
    Location
    CO
    Posts
    7
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: What to do with changing window name...

    Yes, this was recorded by QTP...the reason there are two window objects is b/c they reference objects in the "Object Repository" (i think). I really do not have much experience with QTP so i'm still a little shaky on how it all works. I will give your suggestion a try though...

  4. #4
    Senior Member
    Join Date
    Jan 2000
    Location
    USA, CA
    Posts
    1,998
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: What to do with changing window name...

    In my understanding, it might be parent Window("Application") and child Window("Window Name")
    In Repository it should be represented in such a hierarchy. Have a look, please.

    Basically, you can identify second window like that: Window("index:=1").
    In your case, definately you have to use ObjectSpy, to check out, how QTP define them.
    Hard to say exact solution not to be in real environment. This is not simple case.

  5. #5
    Junior Member
    Join Date
    Jul 2004
    Location
    CO
    Posts
    7
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: What to do with changing window name...

    OK...sorry it's taken me so long to get back to you. I've tried identifying the window like you said, using the index, but it still does not appear to be working.

    Here's what i'm doing:

    </font><blockquote><font size="1" face="Verdana, Arial, Helvetica">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">Window(&quot;Application&quot.Window(&quot;index:=14&quot.WinEdit(&quot;Edit&quot.SetSelection 0,9</pre><hr /></blockquote><font size="2" face="Verdana, Arial, Helvetica">Do i need to refer to the parent window object when calling the child by its unique index? Is it possible to do this without referencing the QTP Object Repository?

    Thanks!

    [ 08-30-2004, 09:06 AM: Message edited by: udlax2181 ]

  6. #6
    Senior Member
    Join Date
    Jan 2000
    Location
    USA, CA
    Posts
    1,998
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: What to do with changing window name...

    Actually, refering to the parent object is used in Descriptive programming.
    In your case: this is indexing similar objects by it appearance on the screen (sequence of invoking, I'd say).
    So. window("index:=14") will refer not only to your AUT, but also to any window, that is open in this particular moment. (including QTP itself as window). Be accurate, to identify that number.
    If object is not in Repository, and no more identification, but Index - there is no prediction of Run TC:
    how many windows will be opened during future PlayBack? We can not garantee always exact environment, that was during recording.

  7. #7
    Junior Member
    Join Date
    Jul 2004
    Location
    Indianapolis
    Posts
    29
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: What to do with changing window name...

    udlax2181,
    Try giving more than one property of the window in the desc. prog. code along with expected index. Then it'll be easier for QTP 2 identify the relative window.
    Regards,
    Prof. QTP
    ------------------------
    ------------------------
    Come home to the Future
    ------------------------
    ------------------------

  8. #8
    Junior Member
    Join Date
    Jul 2004
    Location
    CO
    Posts
    7
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: What to do with changing window name...

    Ok...i figured it out. In my script I was able to pull and store the value that changed in the window on each iteration of the script. I created a string that was the window name and stored it in the local DataTable. Then I went back into the Object Repository and changed the object name, of the window who's name changes, to something more generic and then changed the "regexpwndtitle" property value to the value that I stored in the DataTable. This way the object repository was always refering to a value that was dynamically chaging through each iteration of the test.

    Example code:

    </font><blockquote><font size="1" face="Verdana, Arial, Helvetica">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">'string creation
    DataTable(&quot;order_num_window&quot;, &quot;Action1&quot = &quot;Order &quot; &amp; current_ord_num

    'now I have the exact window name stored in a string so i can reference it in the object repository

    'so now if i called the window object &quot;Order&quot; in the object repository, i can refer to it like so

    .Window(&quot;Order&quot.WinButton(&quot;Done&quot.Click</pre><hr /></blockquote><font size="2" face="Verdana, Arial, Helvetica">

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 10.71%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 05:49 PM.

Copyright BetaSoft Inc.