Forum Discussion
For issue 1) rraghvani example is a good one. However, these are additional things you can also try:
✅ 1. Standard Scrollbars (Most Common Case)
If the control uses standard Windows scrollbars, TestComplete usually exposes them via the VScroll and HScroll properties.
var wnd = Aliases.MyApp.MainWindow.ScrollableControl;
// Scroll vertically
wnd.VScroll.Pos = 50; // set vertical position
Log.Message("Current vertical scroll position: " + wnd.VScroll.Pos);
// Scroll horizontally
wnd.HScroll.Pos = 30; // set horizontal position
You can also check:
- VScroll.Max, VScroll.Min
- HScroll.Max, HScroll.Min
Use Object Spy to confirm that VScroll and HScroll exist.
✅ 2. Scroll with Keyboard Keys (Fallback)
If the object doesn’t expose scrollbars:
var control = Aliases.MyApp.MainWindow.ScrollableControl;
// Scroll down with arrow key
control.Keys("[Down]");
// Scroll up
control.Keys("[Up]");
// Scroll page down
control.Keys("[PgDn]");
// Scroll to end
control.Keys("[Ctrl+End]");
✅ 3. Scroll with Mouse Wheel
If the control reacts to the mouse wheel:
var control = Aliases.MyApp.MainWindow.ScrollableControl;
// Scroll down
control.MouseWheel(3);
// Scroll up
control.MouseWheel(-3);
✅ 4. Scroll into View (Child Control)
If you want to scroll a child object into view:
var child = Aliases.MyApp.MainWindow.ScrollableControl.SomeChildControl;
child.ScrollIntoView();
⚠️ 5. Custom Scrollbars (Non-standard Controls)
If the control uses custom or owner-drawn scrollbars, you might not see VScroll or HScroll at all. In this case, you’ll need to:
Option A: Click scrollbar arrows or drag manually
var scrollbarDown = Aliases.MyApp.MainWindow.ScrollbarDownButton;
scrollbarDown.Click();
Option B: Drag scrollbar thumb
Use Drag and Drop methods to simulate a drag of the scrollbar thumb:
var thumb = Aliases.MyApp.MainWindow.ScrollbarThumb;
thumb.Drag(thumb.X, thumb.Y, thumb.X, thumb.Y + 100); // scroll down
Use Object Spy to locate these subcomponents (e.g., scroll buttons, thumb).
🤖 AI-assisted response.
💬 Was this helpful? Click Like to show appreciation.
✅ Got the answer you needed? Mark as Solution to help others find it too.