Forum Discussion

Vars01's avatar
Vars01
Occasional Contributor
4 years ago

Iterating through rows and clicking on specific row element

Hi Team,

 

I am a beginner in TestComplete and coding too. Was creating one basic script and didnt know which method to use:

 

I have data available in rows (example : 10 rows) and I have to iterate through these rows one by one and verify the row details and navigate to desired row to click on the element.

I am unable to understand which method to use FindAll or Find Elements and what to define inside the method. can anyone help me on this.

 

xpath - //table/tbody/tr - common for all rows

 

21 Replies

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    Vars01 :

     

    Hi,

     

    Can you provide a screenshot of the html markup for the table and several its rows? (Or copy-paste it from browser's Developer tools)

    Complimentary screenshot from the Object Browser in TestComplete that corresponds to the same table might help as well.

     

    • Vars01's avatar
      Vars01
      Occasional Contributor

      Marsha_R AlexKaras 

      Thanks for the reply. It worked for me I am able to select the desired row and click on it. I have used do while loop so if the condition is false then also the element should be verified once.

      I have one additional doubt here - if we have button which is enabled in one screen but disabled in another screen how should we verify that. I am putting a condition in while loop as mentioned "while(x.Enabled == true)". but my loop is not stopping even though the button has become false. Is there any solution to check this.

      • Marsha_R's avatar
        Marsha_R
        Champion Level 3

        Even though it looks the same to you, the button probably has a slightly different object name on the other page.  You might not be able to call it "x" all the way through the test.  It might need to be Page1x and Page2x and  you check for enabled separately for the two.