SPONSORS:






User Tag List

Results 1 to 8 of 8
  1. #1
    Senior Member
    Join Date
    Jun 2002
    Posts
    119
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Record Window Declarations not agreeing with runtime

    Testing a web portal application.

    I need a function to locate images and click on them. The names will be changing, and there's no Window ID being reported, so location is what I have to use for identification. All the images I want are in a row -- they are "tabs" that a user is going to click on to go to another page. I have the algorithm I want, that will correctly pick out the images I need to identify, get their locations, and call Click(1, xPos, yPos). In fact I've written the whole thing and watched it work. My code correctly finds them and clicks them.

    But what bothers me is that I see the Record Windows Declarations not reporting the image locations the same way as Silk is apparently seeing them.

    Just now I have it set up to display 2 tabs. I run the Record Windows Declarations and hover over them and see "live" values of

    1178, 75
    1229, 75

    The key to the algorithm is that it looks for images with a specific y-location. But at runtime, the testcase apparently is seeing them at 67. I put debug statements in a loop to get a printout of what Silk is seeing

    RECT r = Images[n].GetRect()
    Print(Str(r.xPos) + ", " + Str(r.yPos))

    I just ran it with two tabs, and got

    1230, 67
    1277, 67

    For now, it's working. As my favorite teacher used to say, "Hey, working is good." But it's very unsettling. I don't like tests dependent on unreliable detection.

    Any ideas?

    ------------------

  2. #2
    Senior Member
    Join Date
    Feb 2000
    Posts
    1,497
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Record Window Declarations not agreeing with runtime

    Just as you must modify object labels and tags after a Record/Declarations to suit your purposes you may also have to adjust coordinate-offset values.

    One of the characteristics of coordinate offsets is that they are affected by a number of things including the thickness of dialog box and window edges, caption heights, and the zero-point reference.

    The zero-point for an offset is going to be Screen, Frame, or client which are roughly equivalent to Desktop, Window/dialog and object. You'll need to experiment with each of them a bit to understand their uses and how to make them fit your needs.


    John


    ------------------

  3. #3
    Senior Member
    Join Date
    Jun 2002
    Posts
    119
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Record Window Declarations not agreeing with runtime

    OK, that helps. At least I'm not going crazy.

    Thanks

    ------------------

  4. #4
    Senior Member
    Join Date
    Jul 2001
    Location
    Westford, MA, USA
    Posts
    160
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Record Window Declarations not agreeing with runtime

    A few observations:

    GetRect(TRUE) returns the coords relative to the whole desktop. Then you can (often) do a Desktop.Click() and you'll have more reliable coordinates -- because they won't be relative to a parent window. (Although using the relative coords works well, too, as long as you have thoroughly investigated what you are doing.) So tag using the locations tag if you want, but then do a GetRect to find out where you should actually click.

    I don't know whether the location tag in Record - Window Declarations corresponds precisely to the xPos and xSize of the rect. Would have to investigate further (too lazy), but I wouldn't just assume that's correct.

    Your application's main win, even if maximized, might not be as large as the desktop -- ours is off by several pixels. To verify, do a Desktop.GetRect and look at the size. Then maximize your main window and do a <MainWin>.GetRect(TRUE) and see what you learn.

    AG

    ------------------

  5. #5
    Senior Member
    Join Date
    May 2002
    Posts
    448
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Record Window Declarations not agreeing with runtime

    One query though ..

    I thought that relative co-ordinated were more reliable in case the app wasn't under too much makeover, in case we use desktop relative co-ords wouldn't it depend on the screen resolution, monitor and all that stuff ? This would drastically reduce the life and scope of test scripts.

    Am I correct or what ?

    ------------------
    never say die
    Life, that dares send, A challenge to his end,
    And when it comes say, Welcome friend.

  6. #6
    Senior Member
    Join Date
    Feb 2000
    Posts
    1,497
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Record Window Declarations not agreeing with runtime

    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by witchcrop:

    I thought that relative co-ordinated were more reliable in case the app wasn't under too much makeover, in case we use desktop relative co-ords wouldn't it depend on the screen resolution, monitor and all that stuff ? This would drastically reduce the life and scope of test scripts.
    <HR></BLOCKQUOTE>

    The use of coordinates, in my opinion, is a last resort. They are best used in tables or spreadsheets where the environment is essentially static if no other identification method is possible.

    Application location, object location, and screen resolution all come into play to adversely affect the blind targeting of any position you wish to click.

    If you must use this method, isolate the invoke code locally to the container for which it applies. Then abstract that invoke everywhere it's needed rather than allow that offset to multiply.

    John


    ------------------

  7. #7
    Senior Member
    Join Date
    Jul 1999
    Location
    Bellingham, WA USA
    Posts
    1,323
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Record Window Declarations not agreeing with runtime

    Complete agrement here also. Coordinates are an absolute last resort. Also, I believe relative coords are better. Using the desktop methode necessitates that the always appear in the same place. If one works with a non-maximized application, this can cause problems.



    ------------------

  8. #8
    Senior Member
    Join Date
    May 2002
    Posts
    448
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Record Window Declarations not agreeing with runtime

    I thought so.

    Thanks a bunch

    ------------------
    never say die

    [This message has been edited by witchcrop (edited 09-30-2002).]
    Life, that dares send, A challenge to his end,
    And when it comes say, Welcome friend.

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.0.9 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Questions / Answers Form provided by vBAnswers (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominatevBulletin 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 09:26 PM.

Copyright BetaSoft Inc.