This project is read-only.

Problem with finding(checking) embedded checkbox with GetEmbeddedCheckBox() method

Nov 21, 2012 at 2:06 PM

Hi,

First of all I'd like to say thank you for the great solution over Coded UI Testing tool.

Could you please help me with my problem: I've made the test for checking embedded checkboxes with finding them with GetEmbeddedCheckBox() method, but it doesn't work unfortunately for me. Checkbox in the specified cell could not be found.

Here is my code:

 

TableGrid tablePage = CUITe_BrowserWindow.GetBrowserWindow<TableGrid>();
int iRow = tablePage.tableGrid.FindRow(2, "ABC", CUITe_HtmlTableSearchOptions.Greedy);
tablePage.tableGrid.GetEmbeddedCheckBox(iRow, 0).Check();

Actually, there is no difference between my code and example code from Documentation FAQ.

Here is the stack trace:
The playback failed to find the control with the given search properties. Additional Details: TechnologyName: 'Web' ControlType: 'CheckBox' TagName: 'INPUT' Class: '"batchCheckbox"' Name: '"checkedRecords"' Failed to find any control that matched the value "checkedRecords" for the search property Name.
Microsoft.VisualStudio.TestTools.UITest.Extension.UITestControlNotFoundException
at Microsoft.VisualStudio.TestTools.UITesting.Playback.MapControlNotFoundException(COMException ex, IPlaybackContext context)
at Microsoft.VisualStudio.TestTools.UITesting.Playback.MapAndThrowComException(COMException innerException, IPlaybackContext context)
at Microsoft.VisualStudio.TestTools.UITesting.Playback.MapAndThrowException(SystemException exception, IPlaybackContext context)
at Microsoft.VisualStudio.TestTools.UITesting.Playback.MapAndThrowException(SystemException exception, String queryId)
at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.FindFirstDescendant(String queryId, Int32 maxDepth, Int32& timeLeft)
at Microsoft.VisualStudio.TestTools.UITesting.SearchHelper.GetUITestControlRecursive(Boolean useCache, Boolean alwaysSearch, ISearchArgument searchArg, IList`1 windowTitles, Int32& timeLeft)
at Microsoft.VisualStudio.TestTools.UITesting.SearchHelper.GetElement(Boolean useCache, ISearchArgument searchArg)
at Microsoft.VisualStudio.TestTools.UITesting.SearchHelper.Search(ISearchArgument searchArg)
at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.FindInternal()
at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.FindControlIfNecessary()
at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.WaitForControlReady(Int32 millisecondsTimeout)
at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.WaitForControlReady()
at CUITe.Controls.HtmlControls.CUITe_HtmlCheckBox.Check()
in c:\Users\dev\Downloads\cuite-21564\CUITe\Controls\HtmlControls\CUITe_HtmlCheckBox.cs:line 12
at BRM.UITest.CurrencyTest.CreateCurrency()
in c:\TFS\Test.Next.Net\NN\App\Src\BRM.UITest\CurrencyTest.cs:line 64
Error HRESULT E_FAIL has been returned from a call to a COM component.
System.Runtime.InteropServices.COMException
at Microsoft.VisualStudio.TestTools.UITest.Playback.Engine.IScreenElement.FindAllDescendants(String bstrQueryId, Object& pvarResKeys, Int32 cResKeys, Int32 nMaxDepth)
at Microsoft.VisualStudio.TestTools.UITest.Playback.ScreenElement.FindAllScreenElement(String queryId, Int32 depth, Boolean singleQueryId, Boolean throwException, Boolean resetSkipStep)
at Microsoft.VisualStudio.TestTools.UITest.Playback.ScreenElement.FindScreenElement(String queryId, Int32 depth, Boolean resetSkipStep)
at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.FindFirstDescendant(String queryId, Int32 maxDepth, Int32& timeLeft)

 

When I try to check the checkbox finding it with Get<CUITe_HtmlCheckBox>("ABC") - it's ok.

Can you help me please, because finding checkbox by Value is not my case...

Thanks.

 

Jan 17, 2013 at 9:28 AM

Hi anrwey,

Can you provide the sample html and test code that can reproduce the problem please?

Thank you.