SPONSORS:






User Tag List

Results 1 to 9 of 9
  1. #1
    Junior Member
    Join Date
    Apr 2002
    Posts
    10
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How can I tell if a control is scrolled into view?

    Hi,

    I'm fairly new to Silk, and having some problems.

    I'm testing a web application using SilkTest 5.5 SP3 and IE6. Some of the pages are very long, and I'm having trouble with scrolling. ScrollIntoView() doesn't work (although it seemed to when I was using SP1 and IE5) and Click() doesn't automatically scroll controls into view either. I've got the Agent Options "Show windows that are out of view" and "Automatically scroll windows into view" both checked. But it's still not scrolling.

    The controls that I need to click on are a mixture of push-buttons, drop-down lists and links. Most of the links bring up popup menus: the user has to select from the menu to navigate between pages. These popup menus do not work if they are off-screen when activated. So I do have to be able to scroll them into view.

    By using TypeKeys(), I can scroll down a line or a page at a time. Trouble is, I need to know when I've reached the right part of the page.

    I thought I could do this by trying Click(): if the control isn't visible, the click will fail and I can catch the exception and scroll down. However, it seems that either Click() consistently succeeds (even when the control is not visible) or consistently fails (even at the point where scrolling has brought the control into view).

    Maybe I can find a way of getting around this problem too, but is there a nicer, simpler solution, either for scrolling itself or for identifying when I've scrolled far enough?

    I apologise if I've missed something really obvious.

    Thanks,

    Abigail.

  2. #2
    Senior Member
    Join Date
    Dec 2001
    Location
    San Jose, CA
    Posts
    102
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How can I tell if a control is scrolled into view?

    You might try to do following steps.
    - Use Browser.WaitForReady()
    - Use "<Ctrl-End>" and "<Ctrl-Home>" to set the page active.
    - Insert some wait time to perform action on popup objects.

    Michael

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

  3. #3
    Member
    Join Date
    Aug 2002
    Location
    Raleigh
    Posts
    31
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How can I tell if a control is scrolled into view?

    You say "insert some wait time." I was wondering how you do that, I don't see a wait function anywhere.

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

  4. #4
    Senior Member
    Join Date
    Nov 2001
    Location
    UK, Oxford
    Posts
    150
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How can I tell if a control is scrolled into view?

    Sleep

    ------------------
    Tempus fugit, Carpe Diem, et al

  5. #5
    Junior Member
    Join Date
    Apr 2002
    Posts
    10
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How can I tell if a control is scrolled into view?

    Sackaroni: Sleep(n) waits for n seconds.

    mhwee, thanks for your suggestions, but sadly I don't think they help.

    I already use Browser.WaitForReady() while each page loads. I don't think the failure to scroll is a timing issue - the page is fully loaded when the Click() statement is executed. Similarly, adding a delay between bringing up the menu and selecting an option doesn't mean the menu scrolls into view before the option is selected.

    I've seen the suggestion about using Ctrl-Home and Ctrl-End before, but I'm not sure how it's supposed to help. They scroll the page around (to start and end respectively), but they don't seem to make any difference to subsequent function calls. Can you give an example, please?

    I've worked out what's happening when I use TypeKeys() to scroll around the page (and this applies whether I use PgDown, Down or Ctrl-End to move down the page): Although the page appears to be scrolling, Silk can't see the change and still considers only the windows at the top of the page to be exposed. I've tried inserting a FlushCache() call after the TypeKeys(), but it doesn't make any difference. I've also tried SetFocus() before Click(): I can see the focus being set correctly, but Click() still fails with a "window not exposed" error.

    What this means is that I can use the popup menus if they are within the top browser-height or the bottom browser-height of the page, but I can't scroll to the correct place if they are somewhere in the middle, because Silk can't spot it when they become exposed. I need a way of getting Silk to recognise the new visible area after I've used TypeKeys() to move down.

    Any suggestions?

    Abigail.

  6. #6
    Member
    Join Date
    Sep 2002
    Location
    Chicago, Illinois, USA
    Posts
    90
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How can I tell if a control is scrolled into view?

    Try DoClick() intsead of Click()

  7. #7
    Senior Member
    Join Date
    Dec 2001
    Location
    San Jose, CA
    Posts
    102
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How can I tell if a control is scrolled into view?

    Hi Alg24,

    Sound like you didn't even try the suggestion.
    Things don't work as you expected. You should try the suggestion anyway to see what happened because that is what you did not expect.

    Like I said, here is what you do.
    - "<Ctrl-End>" and "<Ctrl-Home>" keys sequence makes Silk more aware of the objects.
    If it doesn't work, try using "<Ctrl-Home>" and a loop of "<Pgn-Down>" with sleep(1) in each.

    good luck.
    mhwee

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

  8. #8
    Junior Member
    Join Date
    Apr 2002
    Posts
    10
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How can I tell if a control is scrolled into view?

    Thanks - a combination of those two suggestions seems to have worked. It seems that what I have to do is use Ctrl-End and Ctrl-Home, as described by mhwee, and then use DoClick() rather than Click() on the objects that aren't in view, as suggested by silk1.

    mhwee, I'm sorry, I must have phrased my last reply badly - I didn't mean to imply that I hadn't tried your suggestions, but that they didn't seem to work for me. When I use TypeKeys to enter Ctrl-End and Ctrl-Home, I get the result that I described before - the page scrolls around but subsequent calls to Click() don't behave any differently. *However*, subsequent calls to DoClick() turn out to work nicely.

    Thanks, both of you.

    Abigail.

  9. #9
    Senior Member
    Join Date
    Jul 1999
    Location
    Burlingame CA 94010
    Posts
    502
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How can I tell if a control is scrolled into view?

    There is an AnyWin method - w.ScrollIntoView () which will bring the object into view. You can use this before a click, or other manipulation method.

    Hope this helps

    ------------------
    John W Green
    jwgreen@automationexpertise.com
    http://www.automationexpertise.com

 

 

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 02:05 AM.

Copyright BetaSoft Inc.