none
checkbox RRS feed

  • Question

  • hi all

    i want to select the checkbox in coded UI manual coding but did not find the way can anyone help me in this ?

    Tuesday, April 16, 2019 11:58 AM

All replies

  • Hi Biu Ahmed,

    Welcome to MSDN forum.

    In the coded UI, we could use search property to select the controls we need. If you have many similar controls, the search property must be a unique token for the search control.

    If the UI test is for web form, please refer to the simple sample:

    using Microsoft.VisualStudio.TestTools.UITesting;

    BrowserWindow browser = BrowserWindow.Launch("http://localhost:2993/WebForm1.aspx"); browser.Maximized = true; UITestControl uicheckbox = new UITestControl(browser); uicheckbox.TechnologyName = "Web"; uicheckbox.SearchProperties.Add("ControlType", "CheckBox"); Mouse.Click(uicheckbox);

    If the UI test is for win form, please refer to the simple sample:

    using Microsoft.VisualStudio.TestTools.UITesting;
    using Microsoft.VisualStudio.TestTools.UITesting.WinControls;

    ApplicationUnderTest test = ApplicationUnderTest.Launch("D:\\Coded UI Test\\CodedUITestProject4\\WindowsFormsApp1\\bin\\Debug\\WindowsFormsApp1.exe"); WinCheckBox uICheckBox = new WinCheckBox(test); uICheckBox.TechnologyName = "MSAA"; uICheckBox.SearchProperties.Add("ControlType", "CheckBox"); Mouse.Click(uICheckBox);

    please click here for more information about UItesting SDK. Hope it can help you.

    Best Regards,

    Dylan


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    Wednesday, April 17, 2019 8:47 AM
  • Hi Biu Ahmed,

    Sorry for bothering you.

    Any update for this issue? If Dylan's reply is helpful for you, please mark it as answer, it will be beneficial to other community members which has the similar issue.

    And for your issue: You can also try using the Checked property of a checkbox control.

                // Get the Checkbox instance
                WinCheckBox uICheckBox1CheckBox = xxx;
                // Select 'checkBox1' check box
                uICheckBox1CheckBox.Checked = true;

    Best Regards

    Lance


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, April 23, 2019 6:46 AM