Yes. You Select the Value or Label, then Verify the item you Selected. If you want to check all the values or labels, then you have multiple statements. The below statements return boolean, so they can be the condition within an if statement.
WebUI.verifyOptionPresentByLabel((findTestObject(‘path_to_the_element/select_1_c9f1c5/field1’), ‘ARG’, false)
WebUI.verifyOptionPresentByLabel((findTestObject(‘path_to_the_element/select_1_c9f1c5/field1’), ‘AOR’, false)
however, if you want to have the different labels display, then use the select statement (the below statements return void, so they CANNOT be the condition within an if statement):
WebUI.selectOptionByLabel(findTestObject(‘path_to_the_element/select_1_c9f1c5/field1’), ‘ARG’, false)
WebUI.selectOptionByLabel(findTestObject(‘path_to_the_element/select_1_c9f1c5/field1’), ‘AOR’, false)
and lastly, if you want to ensure that the item that you selected was actually displayed (the below statements return boolean, so they can be the condition within an if statement):
After selecting ARG:
WebUI.verifyOptionSelectedByLabel(findTestObject(‘path_to_the_element/select_1_c9f1c5/field1’), ‘ARG’, false)
After selecting AOR:
WebUI.verifyOptionSelectedByLabel(findTestObject(‘path_to_the_element/select_1_c9f1c5/field1’), ‘AOR’, false)
So, your test could be to “select” a value or label, then use the “verify” the value or label was selected within your “if” statement.
// check label ARG
WebUI.selectOptionByLabel(findTestObject(‘path_to_the_element/select_1_c9f1c5/field1’), ‘Arg’, false)
WebUI.verifyElementVisible(findTestObject(‘path_to_the_element/select_1_c9f1c5/field1’))
if (WebUI.verifyOptionSelectedByLabel(indTestObject(‘path_to_the_element/select_1_c9f1c5/field1’), ‘Arg’, false)) {
} else {
}
// check label AOR
WebUI.selectOptionByLabel(findTestObject(‘path_to_the_element/select_1_c9f1c5/field1’), ‘Aor’, false)
WebUI.verifyElementVisible(findTestObject(‘path_to_the_element/select_1_c9f1c5/field1’))
if (WebUI.verifyOptionSelectedByLabel(indTestObject(‘path_to_the_element/select_1_c9f1c5/field1’), ‘Aor’, false)) {
} else {
}