Forum Discussion
You can try using the scroll bar to bring the object into view (would work similarly to the web method scrollIntoView()) . Here's an example of how you could obtain the scroll bar's min, max and current position then move up/down/left/right as you wish to find the object. I would recommend using doing a quick record and playback test to see how TestComplete is finding the object and if screen coordinates are used (EX: testObject.Click(Xaxis, Yaxis)).
function Main()
{
var p, w, ScrollBar, Slider;
// Obtain the scroll bar object
p = Sys.Process("MyApp");
w = p.Window("TForm1");
ScrollBar = w.Window("TScrollBar");
// Obtain the scroll box's positions and post them to the log
Log.Message("Minimum Position: " + ScrollBar.wMin);
Log.Message("Current Position: " + ScrollBar.wPosition);
Log.Message("Maximum Position: " + ScrollBar.wMax);
// Move the slider to the left
ScrollBar.Keys("[Left][Left][Left][Left]");
// Increase the slider position
Slider = ScrollBar.wPosition + 4;
ScrollBar.wPosition = Slider;
}
[Position reference] and [Scroll reference]
You can also try MouseUp and MouseDown instead of click:
Unlike Click, ClickM, ClickR, DblClick, DblClickM and DblClickR, the MouseDown method does not interact with the tested application. This makes the method useful for testing specific ActiveX controls.
To release the mouse button, use the MouseUp method.
Related Content
- 15 years ago
- 15 years ago
Recent Discussions
- 6 days ago
- 6 days ago
- 10 days ago