Accessing DataGridView Cells Through White

So, I am doing some CI / UI automation tests with White and I am having problems with something. I have a DataGridView in the application, and I set the cell color background differently depending on the state of the application. I want to test these colors during tests with White, but I have problems with this.

Here is what I am trying to do. I can get a view of the grid, but only as a table. Then I have problems because in the end I get simple TableCells instead of DataGridViewCells.

var Table = MainWindow.Window.Get<Table>("DataGridViewName"); var Row = Table.Rows[0]; var Cell = Row.Cells[0]; //invalid //var Color = Cell.Style.BackColor; 

Has anyone come across this before or had any suggestions?

+7
source share
1 answer

Are you sure that backcolor opens through UI Automation? From the low-level coding of UI Automation that I made, I have never seen such a property. I just opened Inspect (similar to UISpy) and pointed it to a DataGridView in a C # WinForms application, and this property is not displayed.

So, since it does not seem to be affected, there is no way to understand it through automation, without waiting for the image to be captured and comparing it with some base with a certain threshold (sounds like a mess).

If you cannot somehow embed this information in another automation property (which would require changing the application under testing), I see no way to do this. :(

+1
source

All Articles