# selectOptionByValue is not working for drop down

**URL:** <https://forum.katalon.com/t/selectoptionbyvalue-is-not-working-for-drop-down/10938>\
**Category:** Miscellaneous\
**Created:** [May 15, 2018, 2:24pm UTC](https://forum.katalon.com/t/selectoptionbyvalue-is-not-working-for-drop-down/10938 "2018-05-15T14:24:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Uday\_Sankar\_Saha](https://avatars.discourse-cdn.com/v4/letter/u/b5ac83/32.png) [@Uday\_Sankar\_Saha](https://forum.katalon.com/u/Uday_Sankar_Saha)\
**Post date:** [May 15, 2018, 2:24pm UTC](https://forum.katalon.com/t/selectoptionbyvalue-is-not-working-for-drop-down/10938/1 "2018-05-15T14:24:38Z")

</div>

My code is not working for a drop down value.  
WebUI.selectOptionByValue(findTestObject(‘Migration REQ Creation/Page\_SID detail (1)/select\_-- None --ISM Code Migr’), ‘ISM Code Migration Request’,

```
true)  

```

This value “ISM Code Migration Request” exists in the drop down field. same code is working for other field though with different object name and value.

**I am getting this message**

05-15-2018 07:52:25 PM - [FAILED] - Unable to select option by value ‘ISM Code Migration Request’ of object ‘Object Repository/Migration REQ Creation/Page\_SID detail (1)/select\_-- None --ISM Code Migr’ using regular expression (Root cause: com.kms.katalon.core.webui.exception.WebElementNotFoundException: Web element with id: ‘Object Repository/Migration REQ Creation/Page\_SID detail (1)/iframe\_gsft\_main’ located by ‘By.xpath: //iframe[@src = ‘com.glideapp.servicecatalog\_cat\_item\_view.do?sysparm\_catalog=e0d08b13c3330100c8b837659bba8fb4&v=1&sysparm\_clear\_stack=yes&sysparm\_id=955920d1f9ead144cddb5c767d805bb8&sysparm\_nameofstack=fddd78564fc2d3c0255b2f6d0210c7c0&sysparm\_link\_parent=5aff385f1d7ff100b7633835df15e261’ and @name = ‘gsft\_main’ and @id = ‘gsft\_main’]’ not found)

05-15-2018 07:52:25 PM - [END] - End action : selectOptionByValue

05-15-2018 07:52:25 PM - [END] - End Test Case : Test Cases/ISM L2 catalog item REQ creation

05-15-2018 07:52:25 PM - [FAILED] - Test Cases/ISM L2 catalog item REQ creation FAILED because (of) Unable to select option by value ‘ISM Code Migration Request’ of object ‘Object Repository/Migration REQ Creation/Page\_SID detail (1)/select\_-- None --ISM Code Migr’ using regular expression (Root cause: com.kms.katalon.core.webui.exception.WebElementNotFoundException: Web element with id: ‘Object Repository/Migration REQ Creation/Page\_SID detail (1)/iframe\_gsft\_main’ located by ‘By.xpath: //iframe[@src = ‘com.glideapp.servicecatalog\_cat\_item\_view.do?sysparm\_catalog=e0d08b13c3330100c8b837659bba8fb4&v=1&sysparm\_clear\_stack=yes&sysparm\_id=955920d1f9ead144cddb5c767d805bb8&sysparm\_nameofstack=fddd78564fc2d3c0255b2f6d0210c7c0&sysparm\_link\_parent=5aff385f1d7ff100b7633835df15e261’ and @name = ‘gsft\_main’ and @id = ‘gsft\_main’]’ not found)

---

<div class="post-metadata">

**Author:** ![Russ\_Thomas](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/russ_thomas/32/11884_2.png) [@Russ\_Thomas](https://forum.katalon.com/u/Russ_Thomas)\
**Post date:** [May 15, 2018, 10:55pm UTC](https://forum.katalon.com/t/selectoptionbyvalue-is-not-working-for-drop-down/10938/2 "2018-05-15T22:55:45Z")

</div>

It would help if I could see some of the HTML you are using.

The error is quite clear: that element as specified by your TestObject, is not present on the page.

Check:

Spelling (watch for UPPERCASE and lowercase errors)  
Spaces  
Is the element VISIBLE at the time the test step is executing?  
Are you sure it’s a SELECT element with OPTION elements inside it? If not, you’re using the wrong WebUI API.

---

<div class="post-metadata">

**Author:** ![crokatalontest](https://avatars.discourse-cdn.com/v4/letter/c/8e8cbc/32.png) [@crokatalontest](https://forum.katalon.com/u/crokatalontest)\
**Post date:** [May 16, 2018, 6:10am UTC](https://forum.katalon.com/t/selectoptionbyvalue-is-not-working-for-drop-down/10938/3 "2018-05-16T06:10:01Z")

</div>

Is your object inside iframe? (iframe\_gsft\_main)  
If it is, check if your iframe is dynamic and it’s id is changing every time you open it.  
That means your xpath is not valid and you need to adapt/change it

---

<div class="post-metadata">

**Author:** ![Uday\_Sankar\_Saha](https://avatars.discourse-cdn.com/v4/letter/u/b5ac83/32.png) [@Uday\_Sankar\_Saha](https://forum.katalon.com/u/Uday_Sankar_Saha)\
**Post date:** [May 20, 2018, 1:33pm UTC](https://forum.katalon.com/t/selectoptionbyvalue-is-not-working-for-drop-down/10938/4 "2018-05-20T13:33:44Z")

</div>

Hi [crokatalontest](http://forum.katalon.com/profile/5173/crokatalontest),  
thank you so much. you are correct. It worked by changing the correct iframe path 🙂
