locked
Only visible rows in a table are selected RRS feed

  • Question

  • Hi,

    Using CodedUI in Visual studio Enterprise 2015 we are testing an application that has a table being updated dynamically. At the end of the test case I grab the contents of this table using the following code...

    WinClient OrdersDataPanel = this.AppMainWindow.ConsolesPanel.TableForOrders.UIDataPanelClient;
    UITestControlCollection rowcontrol = new UITestControlCollection();
    rowcontrol = OrdersDataPanel.GetChildren();

    foreach (UITestControl rows in rowcontrol)
    {
        string row = rows.ToString();
        Console.WriteLine("> {0}", row);
    }

    Unfortunately only 12 rows are selected, which is the amount of rows visible at the time. However, this same code used to select all the rows in the table. I've tried to reorder the table so the more recent orders appear first and thus scroll through the window. But to no avail.. 

    Is there a specific version of .Net that this works with or is there anything else I can try?

    Thanks,

    John.

    • Moved by 宝宝徐 Wednesday, November 15, 2017 5:55 AM
    Thursday, November 2, 2017 12:01 PM

All replies

  • To update... this used to work in an older version of our software, the version it worked in used DevExpress 15.2.9, but has since been updated to DevExpress 17.1.3.

    Thursday, November 2, 2017 1:23 PM
  • >>Unfortunately only 12 rows are selected, which is the amount of rows visible at the time. However, this same code used to select all the rows in the table. I've tried to reorder the table so the more recent orders appear first and thus scroll through the window. But to no avail.. 

    Make sure all the other controls belong to the UITestControlCollection you defined.

    or you need GetChildren () method to find all rows. Please refer to Shruti's answer.

    https://stackoverflow.com/questions/32043575/searching-controls-dynamically-by-adding-search-properties-in-code

    Please let me know if it works.

     

    Best regards,

    Fletcher


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    • Edited by Fletch Zhou Friday, November 3, 2017 6:12 AM
    Friday, November 3, 2017 6:11 AM
  • Shruti's answer is more or less what I have. I am getting all the children in OrdersDataPanel which is the last object in the tree. 

        this.AppMainWindow.ConsolesPanel.TableForOrders.OrdersDataPanel.

    When I use the CodedUISpy TableForOrders includes the column headers and visible rows.

        this.AppMainWindow.ConsolesPanel.TableForOrders

    When I use the CodedUISpy OrdersDataPanel it highlights just the visible rows and when I get children I get just the visible rows and not all the rows in the table as they have scrolled off the client.

    This exact code did work once, but not now. 

    Friday, November 3, 2017 2:49 PM
  • Hi John,

    Thanks for your feedback.

    >>This exact code did work once, but not now. 

    It is weird that the code does not work now, there must be some changes in your side, but I am not sure what exactly caused this.

    Please switch anther method and see:

    UITestControl rowcontrol = new UITestControl();
    
                UITestControlCollection controlCol = rowcontrol.FindMatchingControls();
    
                foreach (UITestControl rows in controlCol)
                {
                    string row = rows.ToString();
                    Console.WriteLine("> {0}", row);
                }
     

    Best regards,

    Fletcher


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    • Edited by Fletch Zhou Monday, November 6, 2017 7:43 AM
    • Proposed as answer by Fletch Zhou Tuesday, November 7, 2017 7:52 AM
    Monday, November 6, 2017 7:43 AM
  • Hi Fletcher,

    Unfortunately this second method returns nothing. The first way I was using returns the number of rows currently visible on the screen.

    The only significant change between my working version and the current version which does not work was the upgrading of the application from 

    DevExpress 15.2.9 to DevExpress 17.1.3. I have also upgraded Dev Express on my machine to correspond with this.

    Thanks,

    John


    Wednesday, November 8, 2017 8:15 AM
  • Hi John,

    Thanks for your feedback.

    >>DevExpress 15.2.9 to DevExpress 17.1.3. I have also upgraded Dev Express on my machine to correspond with this.

    If your code worked well before, and the only difference is the DevExpress upgrade, you could post a thread at DevExpress official support forum where they might give a explanation on this issue.

     

    Best regards,

    Fletcher


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    • Edited by Fletch Zhou Wednesday, November 8, 2017 9:52 AM
    Wednesday, November 8, 2017 9:52 AM