I tried writing Cided UI Tests with Visual Studio 2015 on this webpage: http://demos.telerik.com/aspnetajax/button/examples/radiosandcheckboxes/defaultcs.aspx
where it is supposed to click the checkbox, but I keep receiving an error as it doesn't recognize the kendo control. How am I able to select it without using the recording options? Here is the error:
Test Name: CodedUITestMethod1
Test FullName: CodedUITestProject_test.CodedUITest1.CodedUITestMethod1
Test Source: C:\Team Projects 2015\Demo\CodedUITestProject_test\CodedUITestProject_test\CodedUITest1.cs : line 28
Test Outcome: Failed
Test Duration: 0:01:46.516549
Result Message:
Test method CodedUITestProject_test.CodedUITest1.CodedUITestMethod1 threw exception:
Microsoft.VisualStudio.TestTools.UITest.Extension.UITestControlNotFoundException: The playback failed to find the control with the given search properties. Additional Details:
TechnologyName: 'Web'
ControlType: 'CheckBox'
TagName: 'INPUT'
Id: 'RadButton6'
Failed to find any control that matched the value RadButton6 for the search property Id. ---> System.Runtime.InteropServices.COMException: Error HRESULT E_FAIL has been returned from a call to a COM component.
Here is my code:
public void CodedUITestMethod1()
{
Playback.PlaybackSettings.SearchInMinimizedWindows = false;
string Home = "http://demos.telerik.com/aspnet-ajax/button/examples/radiosandcheckboxes/defaultcs.aspx";
BrowserWindow b = BrowserWindow.Launch(Home);
Playback.PlaybackSettings.DelayBetweenActions = 100000;
b.resizedWindow(1920, 1080); //function to make the window full screen
HtmlCheckBox cbBox = new HtmlCheckBox(b);
//I had used the ID from the Developer Options under F12 initially then changed it to RadButton6 but it doesn't work
cbBox.SearchProperties.Add(HtmlCheckBox.PropertyNames.Id, "RadButton6");
Mouse.Click(cbBox);
}