Forum Discussion

ARANA's avatar
ARANA
Occasional Contributor
2 years ago

Can't click on another tab without coordinates defined

Hi all,
I'm new to TestComplete and learning the tool myself. I am automating Desktop application. To start with, my approach is to create Keyword Tests for the scenario and then convert it into script which normally contains coordinates for 'Click' actions. I don't want the dependency on the coordinates in my scripts, so sometimes when I remove them from the scripts, the automated scripts fails ( not always).

For eg in below screen, in my keyword tests I'm clicking on 'Ledger Codes' which has coordinates (661,30) but when I remove them the script fails. I've tried using object spy to spy on the Ledger Codes tab but the Testcomplete can't spy on that particular ' Ledger Codes' tab. I've attached name mapping as well for reference. Is there any way I can click on Ledger tab without depending on coordinates please? 

 

  • What you have written, using VCLObject, that ideally should have worked.

     

    I've noticed, that each of your tabs have numbers which you can select using ALT + number.

    You should be able to do something like, Sys.Process("Finance").VCLObject("dlgGLsetup").VCLObject("pnForm").VCLObject("tnbGLSetup").Keys("~1"); to select Fund Codes tab.

     

     

    Note, in my previous example, the line 

    Aliases.Finance.dlgGLsetup.pnForm.tnbGLSetup.pageFundCodes.Click(); // name mapping

    is based on having a name mapping for pageFundCodes.

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    What you have written, using VCLObject, that ideally should have worked.

     

    I've noticed, that each of your tabs have numbers which you can select using ALT + number.

    You should be able to do something like, Sys.Process("Finance").VCLObject("dlgGLsetup").VCLObject("pnForm").VCLObject("tnbGLSetup").Keys("~1"); to select Fund Codes tab.

     

     

    Note, in my previous example, the line 

    Aliases.Finance.dlgGLsetup.pnForm.tnbGLSetup.pageFundCodes.Click(); // name mapping

    is based on having a name mapping for pageFundCodes.

    • ARANA's avatar
      ARANA
      Occasional Contributor

      I'm able to click on tab 5 using below options

       

      1. Aliases.Finance.dlgGLsetup.pnForm.tnbGLSetup.Keys("~5")

      or 
      Sys.Process("Finance").VCLObject("dlgGLsetup").VCLObject("pnForm").VCLObject("tnbGLSetup").Keys("~5");

       

      Thank you for your help...

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    If you use the Object Browser, can you see the tabs?

     

     

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    Hi,

     

    I am automating Desktop application.

    What your tested application was created with (.Net, Delphi, Java, ...) and what control is used for this tabbed view? (Or can you post here a screenshot of the Object Browser with the tabbed control been selected in it?)

     

  • ARANA's avatar
    ARANA
    Occasional Contributor

    Hi both

    Thanks for the quick response. The application is written in Delphi 5. Please find the object browser screenshot below. 

     

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    You might be able to do something like,

     

    Aliases.Finance.dlgGLsetup.pnForm.tnbGLSetup.ClickTab("Fund Codes");
    Aliases.Finance.dlgGLsetup.pnForm.tnbGLSetup.Click("Fund Codes");
    Aliases.Finance.dlgGLsetup.pnForm.tnbGLSetup.ClickItem("Fund Codes");
    Aliases.Finance.dlgGLsetup.pnForm.tnbGLSetup.pageFundCodes.Click(); // name mapping

     

    In the Methods tab, there might be methods you can use to select your tab page.

     

    See Testing Delphi Applications for more information.

    • ARANA's avatar
      ARANA
      Occasional Contributor

      Hi

      I tried all the suggested options. None of them works.

      1. 'ClickTab' method is not available for tnbGLSetup

      2. 'Click' method option gives me mismatch error

      3. 'ClickItem' method gives unable to find object error

      4. Name mapping gives unable to find object error

       

      I did further investigation using full name as well as below Sys.Process("Finance").VCLObject("dlgGLsetup").VCLObject("pnForm").VCLObject("tnbGLSetup").Window("TSPage", "Ledger Codes", 1).Click().

      It get Non existent object error for Ledger Codes tab as screenshot in attached document

      but it can find Fund Codes which is the default tab when this form is loaded.

      I'm using Python for scripting. I checked with devs, with alt+tab we can click the tab in the application. Is there any way we can use alt +tab in the code?