# Select a dropdown by label

**URL:** <https://forum.katalon.com/t/select-a-dropdown-by-label/37256>\
**Category:** Web Testing\
**Tags:** katalon-studio\
**Created:** [December 7, 2019, 3:46pm UTC](https://forum.katalon.com/t/select-a-dropdown-by-label/37256 "2019-12-07T15:46:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![paul.wade](https://avatars.discourse-cdn.com/v4/letter/p/87869e/32.png) [@paul.wade](https://forum.katalon.com/u/paul.wade)\
**Post date:** [December 7, 2019, 3:46pm UTC](https://forum.katalon.com/t/select-a-dropdown-by-label/37256/1 "2019-12-07T15:46:49Z")

</div>

I have several scripts working correctly but struggling with a dropdown. I would like to read a value from Excel and select that value from a dropdown list. This is a subset of my code.

LastRC = findTestData(‘List of ratecard levels’).getValue(‘Name’, index)

WebUI.selectOptionByLabel(findTestObject(‘Object Repository/Ratecard/Page\_TecEFX/select\_’), LastRC, false)

WebUI.verifyOptionSelectedByLabel(findTestObject(‘Object Repository/Ratecard/Page\_TecEFX/select\_’), LastRC, false,  
60)  
I’m pretty certain that LastRC has a value that is in the dropdown but how do I check this, println?

I am expecting an exact match, anything wrong with that code?

Thank you

---

<div class="post-metadata">

**Author:** ![paul.wade](https://avatars.discourse-cdn.com/v4/letter/p/87869e/32.png) [@paul.wade](https://forum.katalon.com/u/paul.wade)\
**Post date:** [December 7, 2019, 5:26pm UTC](https://forum.katalon.com/t/select-a-dropdown-by-label/37256/2 "2019-12-07T17:26:36Z")

</div>

This is the error code log…  
2019-12-07 17:25:05.320 ERROR c.k.katalon.core.main.TestCaseExecutor - ❌ Test Cases/Add ratecard levels FAILED.  
Reason:  
com.kms.katalon.core.exception.StepFailedException: Unable to select option by label  
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.stepFailed(WebUIKeywordMain.groovy:64)  
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:26)  
at com.kms.katalon.core.webui.keyword.builtin.SelectOptionByLabelKeyword.selectOptionByLabel(SelectOptionByLabelKeyword.groovy:98)  
at com.kms.katalon.core.webui.keyword.builtin.SelectOptionByLabelKeyword.execute(SelectOptionByLabelKeyword.groovy:71)  
at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:60)  
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.selectOptionByLabel(WebUiBuiltInKeywords.groovy:1200)  
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$selectOptionByLabel$5.call(Unknown Source)  
at Add ratecard levels.run(Add ratecard levels:27)  
at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)  
at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)  
at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:337)  
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:328)  
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:307)  
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:299)  
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:233)  
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:114)  
at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)  
at TempTestCase1575739306755.run(TempTestCase1575739306755.groovy:23)  
Caused by: java.lang.IllegalArgumentException: Object is null  
at com.kms.katalon.core.helper.KeywordHelper.checkTestObjectParameter(KeywordHelper.java:33)  
at com.kms.katalon.core.webui.keyword.builtin.SelectOptionByLabelKeyword$\_selectOptionByLabel\_closure1.doCall(SelectOptionByLabelKeyword.groovy:80)  
at com.kms.katalon.core.webui.keyword.builtin.SelectOptionByLabelKeyword$\_selectOptionByLabel\_closure1.call(SelectOptionByLabelKeyword.groovy)  
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:20)

---

<div class="post-metadata">

**Author:** ![ThanhTo](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/thanhto/32/697_2.png) [@ThanhTo](https://forum.katalon.com/u/ThanhTo)\
**Post date:** [December 7, 2019, 5:44pm UTC](https://forum.katalon.com/t/select-a-dropdown-by-label/37256/3 "2019-12-07T17:44:55Z")

</div>

> [@paul.wade](#):
>
> at TempTestCase1575739306755.run(TempTestCase1575739306755.groovy:23)  
> Caused by: java.lang.IllegalArgumentException: Object is null

This means that the Test Object is null. Can you provide the relevant test script you’re currently using ? And also make sure you can open the Test Object at the test step which is failing. To check this, in the Manual mode of the test case, you can right click on the object and choose ‘Open {name of test object}’.

---

<div class="post-metadata">

**Author:** ![paul.wade](https://avatars.discourse-cdn.com/v4/letter/p/87869e/32.png) [@paul.wade](https://forum.katalon.com/u/paul.wade)\
**Post date:** [December 7, 2019, 11:43pm UTC](https://forum.katalon.com/t/select-a-dropdown-by-label/37256/4 "2019-12-07T23:43:29Z")

</div>

Thanks, that got me looking in the right place. When I captured the drop down they got named like ‘Select\_ Value 1 Value 2’ hence Select\_ didn’t exist. I removed the values from the name and it worked.  
I’m puzzled as to why Web Record would name the object such that the name included the current values.  
But this fixed my problem. Thank you.
