RobotFramework - Unable to get winform control with exception Failed to get ControlType

485 views Asked by At

I am writing script in RobotFramwork to automate WinForm desktop application, I can identify Grid view but when I try to select cell using official keywords by WhiteLibrary, it returns the following error.

AutomationException: Failed to get ControlType=datagrid,Name=availableCubes_radGrid

The detailed stack trace is the following.

Starting test: SimITTests.Verify Data File Management Data in Cell
20200805 16:22:22.233 :  INFO : ${Grid} = Table. AutomationId:availableCubes_radGrid, Name:Telerik.WinControls.UI.RadGridView ; 119;10, ControlType:table, FrameworkId:WinForm
20200805 16:22:22.235 :  INFO : ${words} = [u'Telerik.WinControls.UI.RadGridView ', u' 119', u'10']
20200805 16:23:21.886 :  FAIL : 
AutomationException: Failed to get ControlType=datagrid,Name=availableCubes_radGrid
   at TestStack.White.UIItems.UIItemContainer.Get(SearchCriteria searchCriteria, TimeSpan timeout)
   at TestStack.White.UIItems.UIItemContainer.Get[T](SearchCriteria searchCriteria)
Ending test:   SimITTests.Verify Data File Management Data in Cell

The Robot Framework script for automation is the following. (for WhiteLibrary)

Verify Gridview Data in Cell
Launch Application    [APPLICATION PATH]   [COMMAND-LINE parameter]
Attach Window    [Application Window Name]
#Maximize Window
Click Item    text:Data File Management
Wait Until Item Exists    availableCubes_radGrid    3
${Grid} =    Get Item    availableCubes_radGrid
Right Click Listview Cell By Index    text=availableCubes_radGrid    2    2

The last line should right click on gridview but it is returning the mentioned error message.

1

There are 1 answers

0
Umar Abbas On

I have found the root cause. The error message appears when Windows is not attached with the Robot Framework / White library and we try to find the control on windows (that is not attached yet).