Forum Discussion

glenmetz's avatar
glenmetz
Occasional Contributor
10 years ago

Keyword Test, Webpage Scroll Down

I'm attempting to create a keyword test to validate a web application.  The application requires scrolling to see all of the visible webpage, and complete a form.  How can I insert a scroll into the keyword test?  TC can't read the scroll bar as a object.  Thank you.

  • I believe the syntax would be:

    TheObjectNameVerifiedUsingTheDisplayObjectSpyButton.ScrollIntoView()

     

    You can pass true or false in as an argument too.

  • "ScrollIntoView" is a method usually available on objects when scripting. Not sure if/how you use it in keyword tests though?

     

    And Chrome has a "MouseWheel" method you could use on the Page object to cause it to scroll. Although I don't know how you'd determine the accuracy - ie. how you'd know when your desired object was in view?

     

    Maybe (pseudocode)

     

    Start Loop
    
      Look for Object
    
      Object Found/visible?
        Yes - Exit Loop
        No - Small scroll via mousewheel
    
    End Loop
    • glenmetz's avatar
      glenmetz
      Occasional Contributor

      I'm not a programmer, which is why I'm attempting to use keyword testing.  

      Regarding the MouseWheel, if I knew scrolling down 6x got the bottom of the page, maybe I could use that?

       

       

       

       

      • baxatob's avatar
        baxatob
        Community Hero

        Actually you don't need to scroll web page to fill the form, because if some input element is presented on the web page, it should be visible for TestComplete.

    • glenmetz's avatar
      glenmetz
      Occasional Contributor

      If I was to use the 'ScrollIntoView' method, would the proper syntax be:

       

      ScrollIntoView.TheObjectNameVerifiedUsingTheDisplayObjectSpyButton

      • tonydugay's avatar
        tonydugay
        Contributor

        I believe the syntax would be:

        TheObjectNameVerifiedUsingTheDisplayObjectSpyButton.ScrollIntoView()

         

        You can pass true or false in as an argument too.