Forum Discussion

lambada's avatar
lambada
Contributor
7 years ago

dynamic table values

Hello everybody!

 

I would like to ask you what is the best way for coding a function in Java script for choosing (click) a value into a dynamic table?

 

Thank you for helping me in advance.

 

Best regards

lambada

31 Replies

  • Hello everybody!

     

    I would like to ask you what is the best way for coding a function in Java script for choosing (click) a value into a dynamic table?

     

    Thank you for helping me in advance.

     

    Best regards

    lambada

    • baxatob's avatar
      baxatob
      Community Hero

      Hi,

       

      Can you provide more details about your application and task - technology used (iOS/Android), screenshots, element properties (Object Browser data) etc?

      • lambada's avatar
        lambada
        Contributor

        Thank you for answering

         

        It is browser testing. There is a application and a table into a side. I have to choose a specific value I need and to click on it. The table is dynamic, so the cell column of the specific value I need is changing by any changes (if bytime new values are generated). 

         

        I hope that explains it better.

         

        BR

  • baxatob thank you, I will try it!

     

    AlexKaras thank you, I will try it. Of course I have recorded it first to see how test complete is dealing with it, but the recorded Java sript contains clicking at a position and not at the expected value. And because this value changes its position I have to write a function by myself, so I was asking if anybody can help me to write a code (Java script). The logic I understand, now I should get the practice.

     

    Later I will give you a feedback. Thank you guys!

    • AlexKaras's avatar
      AlexKaras
      Champion Level 3

      Hi,

       

      > the recorded Java sript contains clicking at a position and not at the expected value.

      Why not to provide a piece of recorded code with your comments? This well could be saving you several days and save our time as well. :)

      Use Object Browser. Object Browser is you primary tool for UI testing in TestComplete. If something is identified in the Object Browser then it can be interacted with from test code. If something is not identified in the Object Browser, but you know that it exists in the tested application, then either you must find a way to make it to be identifiable in the Object Browser or to find a way to do what you need but without interacting with this entity.

      So, use Object Browser, explore your tested page, make a mental correlation between the layout rendered on screen with its internal structure displayed in the Object Browser, talk to developers and ask them to describe you what tools/technologies they used to create the tested page to get better understanding of how internal page objects relate to each other to provide you with the visual experience that you have from the page. This all must help you to understand what and how should be coded in your test code and this is what is required from you here before someone can provide you with some more or less meaningful and relevant code sample.

      • lambada's avatar
        lambada
        Contributor

        Thanks to you.

         

        I am not sure if I am permitted to share my recorded code, but I agree with you, that would be the best.

         

        Test Complete is doing: 

         

        function (){

         

        var browser;


        ... //here are some other vars


        var panel;

         

        browser.BrowserWindow.Click(149, 52); //when I click for typing the webpage www.

        browser.pageWww ... .Keys("... [Enter]"); //typing the webpage www. and I press enter

         

        ... //here are some other test steps

         

        panel.table.cell.Click(36, 19);

         

        ... //here are some other test steps as well

        }

         

        instead of "panel.table.cell.Click(36, 19);" the code should contain something with "name123" beacuse the position changes. Few days later, if I would let the test case play, and TesComplete would execute "panel.table.cell.Click(36, 19);" the test case would fail becaus at the position "panel.table.cell.Click(36, 19);" I wouldn´t find "name123" anymore because the dynamic table changes (some other values will be created meantime).