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

Verify more than one item in drop down

1 Answer 52 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Mallory
Top achievements
Rank 1
Mallory asked on 25 Jan 2012, 06:55 PM
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

1 Answer, 1 is accepted

Sort by
0
Anthony
Telerik team
answered on 25 Jan 2012, 10:23 PM
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
Tags
General Discussions
Asked by
Mallory
Top achievements
Rank 1
Answers by
Anthony
Telerik team
Share this question
or