cancel
Showing results for 
Search instead for 
Did you mean: 

Keyword Test, Webpage Scroll Down

SOLVED
glenmetz
Occasional Contributor

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.

1 ACCEPTED SOLUTION

Accepted Solutions
tonydugay
Contributor

Re: Keyword Test, Webpage Scroll Down

I believe the syntax would be:

TheObjectNameVerifiedUsingTheDisplayObjectSpyButton.ScrollIntoView()

 

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

View solution in original post

7 REPLIES 7
Colin_McCrae
Community Hero

Re: Keyword Test, Webpage Scroll Down

"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
Occasional Contributor

Re: Keyword Test, Webpage Scroll Down

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
Community Hero

Re: Keyword Test, Webpage Scroll Down

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.

Colin_McCrae
Community Hero

Re: Keyword Test, Webpage Scroll Down

If the object required is off the page and not visible, you do sometimes need to activate scrolling of some sort to get to it. (In scripting, ScrollIntoView pretty much always does the trick)

 

Using 6x MouseWheel (it needs a parameter to tell it to scroll up or down) will bring it into view, that will work. But if the page is capable of changing so that extra stuff appears meaning you need 8x, you'll have problems. Hence the scroll, check, scroll again loop.

glenmetz
Occasional Contributor

Re: Keyword Test, Webpage Scroll Down

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

 

ScrollIntoView.TheObjectNameVerifiedUsingTheDisplayObjectSpyButton

tonydugay
Contributor

Re: Keyword Test, Webpage Scroll Down

I believe the syntax would be:

TheObjectNameVerifiedUsingTheDisplayObjectSpyButton.ScrollIntoView()

 

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

View solution in original post

Colin_McCrae
Community Hero

Re: Keyword Test, Webpage Scroll Down

Yep. What Tony said. 🙂

New Here?
Join us and watch the welcome video:
Announcements