Obtaining a list of elements in a drop down


I have items (checkboxes) that can be selected in one web page and based on that selection, those items appear in a drop down of another web page. What would be the best approach to script this? Thanks.

There are likely lots of ways you could do this. My thoughts are you can store the labels (or whatever your checkbox reference is) of the checkboxes in a List<String> and then when you are on the other web page, you can use WebUI.verifyOptionPresentByLabel() of all the references (probably in a loop) in the drop-down.


Ok i did it a different way using booleans. I dont need to check each element in the test case. The issue I encountered however is that when i pass a boolean variable in the test case script, which is used in a custom keyword, the correct boolean value is thrown in the custom keyword. However when i want to use that value returned in a call to another custom keyword from the main script, it gives me null. So it fails here…CustomKeywords.‘clientAccount.ClientAccount.getClientIdentityProviderList’(checkClientIdentityProvider)

Any ideas why i get a null value for the boolean?
This is the code.
//Main script
String integratorLink = “Object Repository/Page_Stratocast portal - Cloud administrators/IntegratorsLink”;
String clientsLink = “Object Repository/Page_Stratocast portal - Client accounts/span_Clients”
String accountName = “Object Repository/Page_Stratocast portal - Client accounts/accountName”
String integratorsHomeLink = “Object Repository/Page_Stratocast portal - Integrators/IntegratorsHomeLink”
Boolean checkClientIdentityProvider

WebUI.callTestCase(findTestCase(‘Admission Authority/Admission Authority - Login - Organizational Account (750)’), [:], FailureHandling.CONTINUE_ON_FAILURE)

//Select Integrator links



//GO to integrator edit page and edit the client identity provider list check box




//Click on the clients link after selecting the integrator account to switch to

//Select the client account name to go into the client’s edit page


//Keyword scripts
def editIntegratorIdentityProviders(checkClientIdentityProvider) {

	WebUI.scrollToElement(findTestObject(clientIdentityProviderList), 5)
	//Verify if yahoo provider is checked or not
	if (WebUI.verifyElementChecked(findTestObject('Object Repository/Page_Stratocast portal - Massimo2.3_Train09 - Edit/YahooCheckBox'), 5, FailureHandling.OPTIONAL)){
		//uncheck the yahoo provider
		WebUI.uncheck(findTestObject('Object Repository/Page_Stratocast portal - Massimo2.3_Train09 - Edit/YahooCheckBox'))
		checkClientIdentityProvider = false
	else {
		WebUI.check(findTestObject('Object Repository/Page_Stratocast portal - Massimo2.3_Train09 - Edit/YahooCheckBox'))
		checkClientIdentityProvider = true
//click on save button
	KeywordUtil.markPassed("checkIdentityProvider = " + checkClientIdentityProvider)
	return checkClientIdentityProvider

def getClientIdentityProviderList(checkClientIdentityProvider) {
WebUI.scrollToElement(findTestObject(replaceAdministratorButton), 5)

	//Select identity provider list
	KeywordUtil.markPassed("checkIdentityProvider = " + checkClientIdentityProvider)
	if (checkClientIdentityProvider){
	  if(WebUI.verifyOptionPresentByLabel(findTestObject(adminIdentityProvider), 'Yahoo!', false, 10, FailureHandling.OPTIONAL)){
		  KeywordUtil.markPassed("Yahoo! account provider was added from the client service provider list")
	  else {
		  KeywordUtil.markFailed("Yahoo! account provider was not added from the client service provider list")
	else {
		if (WebUI.verifyOptionNotPresentByLabel(findTestObject(adminIdentityProvider), 'Yahoo!', false, 10, FailureHandling.OPTIONAL)){
			KeywordUtil.markPassed("Yahoo! account provider was removed from the client service provider list")
		else {
			KeywordUtil.markFailed("Yahoo! account provider was not removed from the client service provider list")

You create the boolean variable in your program (unassigned) and you pass the boolean variable into the Keyword. To collect the result back you can try:

checkClientIdentityProvider = CustomKeywords.'integrators.Integrators.editIntegratorIdentityProviders'(checkClientIdentityProvider)

Or create a boolean GlobalVariable, or a static boolean variable or define the boolean variable with the def identifier and pass that into the Keyword, like below.

def checkClientIdentityProvider = true;


then the variable should work.

Super, thank you :slight_smile: