Verify more than one item in drop down

2 posts, 0 answers
  1. Mallory
    Mallory avatar
    1 posts
    Member since:
    Nov 2011

    Posted 25 Jan 2012 Link to this post

    Hello, I need to verify that item1 or item2 are selected from a drop down. I can only figure out how to verify one selection from a drop down from Advance Verification. I need to plug this verification into an If then else statement.

    So for example, if item 1 or item 2 are selected then do something. When item3 or item4 are selected then do this other thing.

    Thank you - Mallory
  2. Anthony
    Admin
    Anthony avatar
    19 posts

    Posted 25 Jan 2012 Link to this post

    Hello Mallory,

    If you're using an If...Else logical step through the UI, then you can only attach one verification to it. If you need to based your IF statement on two or more conditions, you must do it in a Coded Step.

    Here is an example against this Telerik demo site. After navigating there, I clicked the "CheckBoxes" sub-heading and then clicked the "CheckBoxes" box. This enables more than one selection to be made in the top ComboBox. I then opened it and checked the first and second boxes, and used the following code:

    bool one = Pages.ASPNETComboBoxDemo.CheckBox.Checked;
    bool two = Pages.ASPNETComboBoxDemo.CheckBox0.Checked;
     
    Log.WriteLine("Checkbox 1 is checked: " + one.ToString());
    Log.WriteLine("Checkbox 2 is checked: " + two.ToString());
     
    if (one && two == true)
    {
        Log.WriteLine("Yes");
        this.ExecuteTest("WebTest.tstest");
    }
    else
    {
        Log.WriteLine("No");
        this.ExecuteTest("folder\\WebTest2.tstest");
    }

    If you prefer Visual Basic, use our code converter.

    All the best,
    Anthony
    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
Back to Top