Forum Discussion

Bene's avatar
Bene
Occasional Contributor
4 days ago
Solved

New row in the grid

Hello, I'm using the "Keyword Test" tool. In an order entry form, I want to insert the line items into a grid. The quantity and item number data come from an Excel spreadsheet. It's connected via a data-driven loop. So, I enter the quantity, press Tab, enter the item, press Tab again, and press Enter three times. This adds a new row to the "Item" table.

When testing the application, TestComplete retrieves the data from Excel, but it inserts it into the first row of the "Item" table.

What do I need to do to make TestComplete use the second row? Thank you.

  • Bene's avatar
    Bene
    1 day ago

    After entering the order code, customer name, and order date, I used the TAB key to navigate to the quantity field, not a mouse click.

    I then used the ENTER key to move through the item fields to the next line (new item).

    For order validation and invoicing, I no longer used the function keys (F10) but accessed the menu via the mouse. TC had lost focus and therefore had no access to the function keys.

16 Replies

  • Bene's avatar
    Bene
    Occasional Contributor

    Hi, the test is working now. I had to use TAB and ENTER instead of mouse clicks.

    Thanks so much for your help :-)

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

      Yep!  Sometimes TC does not 'exactly' reproduce what the app is doing as a result of key entries.  Something in the app was likely moving focus for you that it didn't pick up from TC.  You just needed the enter key to 'force' it along in TestComplete.  I am not exactly sure why this happens.  Sometimes I hit enter out of habit and don't code it into my test script, hence the script record 😉     

      Glad you found it!  Thanks for the like,  

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

      You mentioned Tab and Enter in your original question, which wasn't working correctly, and I had suggest to use the mouse to select the fields. What has changed?

      • Bene's avatar
        Bene
        Occasional Contributor

        After entering the order code, customer name, and order date, I used the TAB key to navigate to the quantity field, not a mouse click.

        I then used the ENTER key to move through the item fields to the next line (new item).

        For order validation and invoicing, I no longer used the function keys (F10) but accessed the menu via the mouse. TC had lost focus and therefore had no access to the function keys.

  • Bene's avatar
    Bene
    Occasional Contributor

    Hi, thank you all for the many replies. I will try them out in the next few days and share my solution with you.

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

    TestComplete record and play is good; however, in your case, you will need to figure out what is the difference between the record and the play to adjust. To start, and accelerate your tool learning curve, rraghvani pointed out references for you to cover.

    To help you debug, I suggest you isolate such problematic step in a "new test project" that consistently starts a fresh session landing on the grid to interact with as the user would. To simplify You could hard code your variables for this test.

    1. Start with the Detailed Test Log by viewing each Message entry Details, as well as the Picture that highlights TestComplete element interaction.
    2. Double click on the Message to jump back to the KeyWords step where you can right click to Highlight on screen or to navigate to the NameMapping Alias.
    3. In the NameMapping Aliases node, right click to Highlight or to "Find Mapped Object".
    4. In both Mapped Objects and Aliases you can update Criteria or manually map objects 

    Once TestComplete record is finished, inspect the NameMapping node Mapping Criteria to validate they are unique, properly points back to the object, and especially after you start a new session.

    👍 Found it helpful? Click Like
    ✅ Issue resolved? Click Mark as Solution

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

    Hi Bene,

    I typically do a Record New Keyword Test for situations like this.  This lets me see the KWT TestComplete creates based on my on screen actions. 

     I enter the quantity, press Tab, enter the item, press Tab again, and press Enter three times. This adds a new row to the "Item" table.

    If I record this using Notepad as the tested app it records a 'Keys' operation....

    What does your do? Pay attention to the Description as well.  Good info there. 🙂 You can use this tool to see what TC is doing and what you may need to do to get it to the second row.

    ... If you find my posts helpful drop me a like! 👍 Be sure to mark or post the solution to help others out and to credit the one who helped you. 😎

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

    How would you manually do this? 

    TestComplete can replicate user interactions as long as you call the appropriate methods and actions. While you mentioned pressing the Tab key multiple times to move between fields, this approach relies on keyboard navigation order and is generally outdated and less reliable. Instead, you should interact with the application the same way a typical user would do, such as clicking fields with the mouse, if that reflects real user behaviour.

    • Bene's avatar
      Bene
      Occasional Contributor

      After pressing the Enter key three times, the cursor automatically moves to the next line in the Quantity field.

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

        I think the issue is relating to grid focus and row activation. TestComplete is entering data into the currently focused row. If the grid focus never actually moves to row 2, the next iteration of your data-driven loop will still write into row 1.

        Instead of relying on multiple Tab and Enter key presses, you should explicitly tell TestComplete to commit the current row, and then activate or click the next row