SelectedRows strange behavior

Aug 18, 2008 at 2:17 PM
Hello,

I got very strange behavior, when I use the SelectedRows property for a grid - when run the test - the scroll starts moving up and down, and I can't reach any other applications at the moments the test is running.Clicking on the grid -> the test fails with the next error:

Failed: Bricks.BricksException : Error invoking ListView.get_SelectedRows
  ----> Core.UIItems.UIActionException : Could not make the ListViewRow with AutomationId=<empty> and Name=<empty> visible, after waiting for 5000 ms

This is  the code I used:
ListView grid = window.Get<ListView>("mygrid");
ListViewRows sRows =grid.SelectedRows;

This is very odd on my opinion
Aug 18, 2008 at 4:26 PM
Edited Aug 18, 2008 at 4:31 PM
Another strange thing that just happened in one of my tests is when simulate holding 'Shift' or 'Control' keys- even when exit the debug mode(and even kill VS process) -> all my actions are as if the ctrl or the shift keys are still held ( I also tried using keyB.LeaveKey(Core.WindowsAPI.KeyboardInput.SpecialKeys.CONTROL); )-> I can't switch between windows, can't write in text file, etc . I needed even to restart my pc to get rid of this.

Had anyone experienced similar problems?
Coordinator
Aug 20, 2008 at 4:08 PM
How many items do you have in ListView? If you leave the test running how long it runs before coming out with error.

Regarding your second problem:
You need to leave both the keys.
If it still doesn't work you can press control and alt keys on right hand side of your keyboard to fix the problem. Let me know how it goes.
Aug 21, 2008 at 9:46 AM
I have 77 items in my ListView and the test runs about 17 seconds before the error comes out. The same time is needed for the test to be executed, when <ListViewRows sRows =grid.SelectedRows; > is not used.

Pressing control and alt keys on right hand side of keyboard does fix the problem.

Thank you
Aug 21, 2008 at 9:55 AM
I wanted to get the count of the selectedrows and also tried that property, but I face with similar behavior.

I tried to multiselect rows using shift key:

            rows[1].Cells[0].Click();
            keyB.HoldKey(Core.WindowsAPI.KeyboardInput.SpecialKeys.SHIFT);
            rows[10].Cells[0].Click();
            keyB.LeaveKey(Core.WindowsAPI.KeyboardInput.SpecialKeys.SHIFT);
           Assert.AreEqual(10, gridView.SelectedRows.Count);

I don't receive the Error invoking ListView.get_SelectedRows, but the scroll in the grid is moving up and down continuously


Aug 21, 2008 at 11:56 AM
Hello,

Thank you for your reply.

There are 124 items in the ListView. I ran the test several times and the error appeared in a different moment - once it took only 3 second to fail, but it was a ran which took 30 seconds to get failed.
I'm working on wpf desktop application ,if this matters.

According to the ctrl and shift buttons - you are right - I used Core.WindowsAPI.KeyboardInput.SpecialKeys.CONTROL , but I missed to put Core.WindowsAPI.KeyboardInput.SpecialKeys.SHIFT in the code, so putting it fixed the problem with the strange behavior.



Coordinator
Aug 22, 2008 at 3:19 PM
Can you do a grid.LogStructure() and send me the output.
Aug 25, 2008 at 10:20 AM
That's the output:

AutomationId: Grid1
ControlType: ControlType.DataGrid
Name:
HelpText:
Bounding rectangle: 100,150,584,334
ClassName: GridView
IsOffScreen: False

    AutomationId:
    ControlType: ControlType.DataItem
    Name: Windows.Data.DataRecord
    HelpText:
    Bounding rectangle: 111,231,320,24
    ClassName: GridViewRow
    IsOffScreen: False

        AutomationId:
        ControlType: ControlType.Text
        Name: John
        HelpText:
        Bounding rectangle: 131,232,100,22
        ClassName: GridViewCell
        IsOffScreen: False

            AutomationId:
            ControlType: ControlType.Button
            Name: BeginEdit
            HelpText: BeginEdit
            Bounding rectangle: 131,232,100,22
            ClassName: BeginEdit
            IsOffScreen: False

            AutomationId:
            ControlType: ControlType.Button
            Name: CommitEdit
            HelpText: CommitEdit
            Bounding rectangle: 131,232,100,22
            ClassName: CommitEdit
            IsOffScreen: False

            AutomationId:
            ControlType: ControlType.Button
            Name: CancelEdit
            HelpText: CancelEdit
            Bounding rectangle: 131,232,100,22
            ClassName: CancelEdit
            IsOffScreen: False

        AutomationId:
        ControlType: ControlType.Text
        Name: Dundy
        HelpText:
        Bounding rectangle: 231,232,100,22
        ClassName: GridViewCell
        IsOffScreen: False

            AutomationId:
            ControlType: ControlType.Button
            Name: BeginEdit
            HelpText: BeginEdit
            Bounding rectangle: 231,232,100,22
            ClassName: BeginEdit
            IsOffScreen: False

            AutomationId:
            ControlType: ControlType.Button
            Name: CommitEdit
            HelpText: CommitEdit
            Bounding rectangle: 231,232,100,22
            ClassName: CommitEdit
            IsOffScreen: False

            AutomationId:
            ControlType: ControlType.Button
            Name: CancelEdit
            HelpText: CancelEdit
            Bounding rectangle: 231,232,100,22
            ClassName: CancelEdit
            IsOffScreen: False

        AutomationId:
        ControlType: ControlType.Text
        Name: 75
        HelpText:
        Bounding rectangle: 331,232,100,22
        ClassName: GridViewCell
        IsOffScreen: False

            AutomationId:
            ControlType: ControlType.Button
            Name: BeginEdit
            HelpText: BeginEdit
            Bounding rectangle: 331,232,100,22
            ClassName: BeginEdit
            IsOffScreen: False

            AutomationId:
            ControlType: ControlType.Button
            Name: CommitEdit
            HelpText: CommitEdit
            Bounding rectangle: 331,232,100,22
            ClassName: CommitEdit
            IsOffScreen: False

            AutomationId:
            ControlType: ControlType.Button
            Name: CancelEdit
            HelpText: CancelEdit
            Bounding rectangle: 331,232,100,22
            ClassName: CancelEdit
            IsOffScreen: False

    AutomationId:
    ControlType: ControlType.DataItem
    Name: Windows.Data.DataRecord
    HelpText:
    Bounding rectangle: 111,255,320,24
    ClassName: GridViewRow
    IsOffScreen: False

        AutomationId:
        ControlType: ControlType.Text
        Name: Yvon
        HelpText:
        Bounding rectangle: 131,256,100,22
        ClassName: GridViewCell
        IsOffScreen: False

            AutomationId:
            ControlType: ControlType.Button
            Name: BeginEdit
            HelpText: BeginEdit
            Bounding rectangle: 131,256,100,22
            ClassName: BeginEdit
            IsOffScreen: False

            AutomationId:
            ControlType: ControlType.Button
            Name: CommitEdit
            HelpText: CommitEdit
            Bounding rectangle: 131,256,100,22
            ClassName: CommitEdit
            IsOffScreen: False

            AutomationId:
            ControlType: ControlType.Button
            Name: CancelEdit
            HelpText: CancelEdit
            Bounding rectangle: 131,256,100,22
            ClassName: CancelEdit
            IsOffScreen: False

        AutomationId:
        ControlType: ControlType.Text
        Name: Little
        HelpText:
        Bounding rectangle: 231,256,100,22
        ClassName: GridViewCell
        IsOffScreen: False

            AutomationId:
            ControlType: ControlType.Button
            Name: BeginEdit
            HelpText: BeginEdit
            Bounding rectangle: 231,256,100,22
            ClassName: BeginEdit
            IsOffScreen: False

            AutomationId:
            ControlType: ControlType.Button
            Name: CommitEdit
            HelpText: CommitEdit
            Bounding rectangle: 231,256,100,22
            ClassName: CommitEdit
            IsOffScreen: False

            AutomationId:
            ControlType: ControlType.Button
            Name: CancelEdit
            HelpText: CancelEdit
            Bounding rectangle: 231,256,100,22
            ClassName: CancelEdit
            IsOffScreen: False

        AutomationId:
        ControlType: ControlType.Text
        Name: 25
        HelpText:
        Bounding rectangle: 331,256,100,22
        ClassName: GridViewCell
        IsOffScreen: False

            AutomationId:
            ControlType: ControlType.Button
            Name: BeginEdit
            HelpText: BeginEdit
            Bounding rectangle: 331,256,100,22
            ClassName: BeginEdit
            IsOffScreen: False

            AutomationId:
            ControlType: ControlType.Button
            Name: CommitEdit
            HelpText: CommitEdit
            Bounding rectangle: 331,256,100,22
            ClassName: CommitEdit
            IsOffScreen: False

            AutomationId:
            ControlType: ControlType.Button
            Name: CancelEdit
            HelpText: CancelEdit
            Bounding rectangle: 331,256,100,22
            ClassName: CancelEdit
            IsOffScreen: False