Forum Discussion

hina's avatar
hina
Contributor
3 days ago

TestComplete multiple inquiries / issues

Hi,

I have few inquiries I thought to list them all at once:

  1.  How to scroll and click an object that is not visible on screen on desktop application, SetFocus() doesn't work.
  2. TestComplete new version 15.77 is simulating shift key while executing test cases, if key method is called anywhere with any parameter. I am working with C#, if it helps.
  3. I am trying to execute multiple projects in sequence. I have specified the sequence of test cases to execute in Execution Plan. I have also specified and enabled Projects to run in Test Items under Project Suite properties. Currently I have 2 projects in project suite and when I try to run 1 test case from each project by right clicking project suite and clicking run, it runs the test cases I have selected but when I select all test cases and try to run project suite, it only runs first project, it doesn't run the second project, not sure why it's doing that. Alternatively, please also provide the script to run the project suite from command line using TestComplete as I do not have Test Execute.

Thanks,

Hina

8 Replies

  • Hassan_Ballan's avatar
    Hassan_Ballan
    Icon for Champion Level 3 rankChampion Level 3

    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.

  • rraghvani's avatar
    rraghvani
    Icon for Champion Level 3 rankChampion Level 3

    Ignoring rule "3. One thread per one problem" just this once!

    1. You could iterate through the scrollbar positions until the object becomes visible on screen and until scrollbar end position has been reached. Pseudocode code example
      var scrollBar = YourContainerObject.VScroll;
      while (!YourTargetObject.VisibleOnScreen && scrollBar.Position < scrollBar.Max) {
          scrollBar.Position += 10;
          Delay(500); // Allow time to scroll
      }
      YourTargetObject.Click();

       

    2.  I don't understand this question. Do you want to perform a Shift Key?

    3. Within TestComplete you can have Project Suite, having a number of Projects. You can also set Test Items, to run all the projects it includes. Here's an example, where I run all projects within the project suite, in order

      If you refer to TestComplete Command Line, there are several examples of running TestComplete via the command line shown.

    • hina's avatar
      hina
      Contributor

      Hi rraghvani,

      Thank you for your reply.

      2) I think it's a bug introduced in TestComplete 15.77 version, it wasn't behaving like this before.

      I am trying to select 2 objects in the script below while simulating Shift key. After executing the test case below whatever I execute afterwards it simulates Shift Key.

      // Select the second dataset to compare
        var axisel = Sys["Process"]("AXISEL");
        var masterListView = axisel["WinFormsObject"]("MainForm")["WinFormsObject"]("splitContainer1")["WinFormsObject"]("SplitterPanel", "", 2)["WinFormsObject"]("splitContainer2")["WinFormsObject"]("SplitterPanel", "", 1)["WinFormsObject"]("WorkAreaDetailView")["WinFormsObject"]("splitContainer1")["WinFormsObject"]("SplitterPanel", "")["WinFormsObject"]("tabControl")["WinFormsObject"]("tabPageDatasets")["WinFormsObject"]("DatasetView")["WinFormsObject"]("splitContainer1")["WinFormsObject"]("SplitterPanel", "", 1)["WinFormsObject"]("ItemList");
        var listItem = masterListView["ListItem"](DatasetName2);
        listItem["Click"](75, 10, skShift);
        listItem["ClickR"](75, 10, skShift);
        Delay(500);
        masterListView["StripPopupMenu"]["Click"]("Advanced|Compare|Compare Two Highlighted Datasets... ");
        Delay(1000);

      • rraghvani's avatar
        rraghvani
        Icon for Champion Level 3 rankChampion Level 3

        Thanks for clarifying; I understand now. It is a bug that was noticed in the post .Click action doesn&#39;t release Ctrl | SmartBear Community when using the skCtrl key. It could be related to the bug fix they implemented, which also affects skShift.

        • skCtrl key not functioning as expected. Resolved a bug that prevented simulated skCtrl key presses from selecting multiple items. The fix restores correct multi-select behavior in 32-bit environments.

         

  • Hassan_Ballan's avatar
    Hassan_Ballan
    Icon for Champion Level 3 rankChampion Level 3

    Hi hina​ 

    I encourage you to follow this community important rule SmartBear Community Rules | SmartBear Community 
    3. One thread per one problem
    Please do not ask several questions in one thread. First of all, they may not be connected to each other. Besides, you will get replies faster if you separate them into different threads posted to the relevant forums.

    I am having difficulties replying to any point as I am not an expert on all three subjects.

    • hina's avatar
      hina
      Contributor

      Hi Hassan,

      Sorry about that, I thought instead of creating multiple threads I would ask all questions in one thread. I didn't know the Rules, I will be careful next time and it makes sense.

      Thanks,

      Hina

      • Hassan_Ballan's avatar
        Hassan_Ballan
        Icon for Champion Level 3 rankChampion Level 3

        No worries, it's about you getting better attention from the community and keeping these threads organized for future readers. Looking forward to be able to address one of your individual issues.