This is a migrated thread and some comments may be shown as answers.

Not able to validate checkbox property

10 Answers 198 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
sonal
Top achievements
Rank 1
sonal asked on 28 Sep 2011, 05:51 PM
I am trying Following code to validate check Box property
      
              SortedList<float, GridViewHeaderCell> columns = new SortedList<float,GridViewHeaderCell>();
              RadGridView grid = Pages.proj1.SilverlightApp.MasterDataGridTigerradgridview;
             GridViewHeaderRow header = grid.HeaderRow;

             IList<GridViewRow> rows = grid.Find.AllByType<GridViewRow>();
                    /*  GridViewCell cell = rows[r].Cells[StatusCol];
                       cell.User.Click(MouseClickType.LeftDoubleClick);
                       cell.Refresh();
                       
                       FrameworkElement Active = cell.Find.ByAutomationId("activeCheckBox");
                        if (Active.IsChecked == false)
            
                        Active.Check(true);*/

I am getting following error for last two row this code,
c:\Automation1\Manage Jobs\DATA\JobDimention\ADD_JobDimention.tstest.cs: Line 145: (CS1061) 'ArtOfTest.WebAii.Silverlight.FrameworkElement' does not contain a definition for 'Check' and no extension method 'Check' accepting a first argument of type 'ArtOfTest.WebAii.Silverlight.FrameworkElement' could be found (are you missing a using directive or an assembly reference?)
Can you you guide me how can i fix this issue?

Note : Check box in part of RadGridCell as shown in attached screenshot

10 Answers, 1 is accepted

Sort by
0
Plamen
Telerik team
answered on 29 Sep 2011, 03:23 PM
Hello Sonal,

I'm sorry you are running into this problem. FrameworkElement is base class that represents any visual element in the Silverlight application, but it doesn't contain "IsChecked" property and "Check" method. Please use the CheckBox class instead. Here is the code: 
RadGridView grid = Pages.proj1.SilverlightApp.MasterDataGridTigerradgridview;
 
IList<GridViewRow> rows = grid.Find.AllByType<GridViewRow>();
GridViewCell cell = rows[r].Cells[StatusCol];
cell.User.Click(MouseClickType.LeftDoubleClick);
cell.Refresh();
 
CheckBox Active = cell.Find.ByAutomationId<CheckBox>("activeCheckBox");
//CheckBox Active = cell.Find.ByType<CheckBox>();
if (Active.IsChecked == false)
 
Active.Check(true);

Hope this helps!

Kind regards,
Plamen
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
sonal
Top achievements
Rank 1
answered on 05 Oct 2011, 09:51 PM
That Works.
Thanks Plamen.
0
Christopher
Top achievements
Rank 1
answered on 24 Feb 2012, 05:24 PM
So to verify a checkbox, a custom step is required? I would have thought this would be available as a regular non customized step. How about a verification check?

Regards,

Chris 
0
Plamen
Telerik team
answered on 28 Feb 2012, 06:17 PM
Hello Christopher,

No, coded step is not required in this particular scenario. I just showed to Sonal how to modify the code to work correctly. The same scenario can be easily accomplished through the Test Studio UI. Here's a video demonstrating that.

Regards,
Plamen
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
John
Top achievements
Rank 2
answered on 29 Feb 2012, 02:17 PM
Plamen,
I like your solution however I think Christopher was looking for was a dynamic solution for Grid with different number of rows.

My Two Cents,
John
0
Plamen
Telerik team
answered on 01 Mar 2012, 04:31 PM
Hi John,

Could you please elaborate more on what do you mean by "dynamic solution for Grid with different number of rows". If you have a specific scenario, please explained it to me in details, so that I can assist you in finding the best solution for it.  

Kind regards,
Plamen
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Ruud
Top achievements
Rank 1
answered on 05 Mar 2020, 09:34 AM
Would it be possible to reupload that video demonstration to Screencast or elsewhere? The link is not working anymore and multiple threads about checkbox verification relate to that demonstration. Since I'm also stuck trying to find out how to verify a checkbox state (true/false), I'd love to see how it's done through UI steps (without custom code).
0
Elena
Telerik team
answered on 05 Mar 2020, 12:33 PM

Hi Ruud,

Please, note that you refer to a thread from 8 years ago so the video wouldn't be relevant. Anyways, during that time we have worked on improving the features in Test Studio and enhancing the user help documentation, so I hope I correctly understood what you are stuck with and will refer the suitable resources. 

As far as I understand you would like to have a step within a test, which verified what is the state of a checkbox - whether checked or not. Test Studio allows you to add verification steps, which can verify different attributes of the elements on page. One way to add a verification is to choose one of the quick verification options in the Elements menu during a recording session. Alternatively, you can access further options to verify the state of an element through the Build step... option, which allows you to add Advanced verifications

I hope this will be helpful for you to sort out your struggles. If I have misread what troubles you experience, please, do not hesitate to get back to me and provide further details about the faced difficulties. 

Thank you in advance for your understanding and cooperation.

Regards,
Elena
Progress Telerik

 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
0
Vedha
Top achievements
Rank 1
answered on 08 Jan 2021, 07:48 AM

Please check if it works 

 

 

0
Elena
Telerik team
answered on 11 Jan 2021, 02:43 PM

Hi Vedha,

Can you, please, elaborate more on the difficulties you experience? What is the scenario you are trying to cover and what outcome you see from the shared code? Did this piece of code used to work before and it suddenly stopped? Or this is the first time you are trying to set it up and it doesn't perform as you expect it? 

Will it be possible to prepare a sample test against a public available page to demonstrate the misbehavior? I guess you can use any of the Telerik controls demo page (this grid seems to be similar to the one you are automating).

I am looking forward to hearing back from you.

Regards,
Elena
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Test Studio course! Check it out at https://learn.telerik.com/.
Tags
General Discussions
Asked by
sonal
Top achievements
Rank 1
Answers by
Plamen
Telerik team
sonal
Top achievements
Rank 1
Christopher
Top achievements
Rank 1
John
Top achievements
Rank 2
Ruud
Top achievements
Rank 1
Elena
Telerik team
Vedha
Top achievements
Rank 1
Share this question
or