How to select based on partial text from options available in the dropdown list

I have a dropdown list in which the option i wanted to select keeps changing its position, so i cannot go by ‘selectOptionByIndex’
Example of my dropdown list options:
Gatter-01/repository
Clums-90/summary.

WebUI.selectOptionByValue(findTestObject(‘Page_586/From’),’*90*’,true)

Should the above statement return the second option in my dropdown?

i can be wrong, but i think regexp should look like:
WebUI.selectOptionByValue(findTestObject(‘Page_586/From’),’.*90.*’,true)

1 Like

It worked. Thank you very much.

Hi Andrej, I have similar case: How to handle scenario 3 … ?

_// Scenario 1 : Working _

WebUI.selectOptionByLabel(findTestObject(‘Product’), ‘Air Lines’, false)

_// Scenario 2 : Working _

WebUI.selectOptionByLabel(findTestObject(‘SQ/Quote_Info_tab/Product’),’.*Air.*’,true)

// Scenario 3 : Not Working since 'a’ is lowercase in ‘air’

WebUI.selectOptionByLabel(findTestObject(‘SQ/Quote_Info_tab/Product’),’.*air.*’,true)

WebUI.selectOptionByLabel(findTestObject('SQ/Quote_Info_tab/Product'),'.*[Aa]ir.*',true)
not sure about this, but can work too :
WebUI.selectOptionByLabel(findTestObject('SQ/Quote_Info_tab/Product'),'(?i).*AIR.*',true)

(?i) is for - ignore case
2 Likes

Andrej Podhajský said:

WebUI.selectOptionByLabel(findTestObject('SQ/Quote_Info_tab/Product'),'.*[Aa]ir.*',true)

not sure about this, but can work too :
WebUI.selectOptionByLabel(findTestObject(‘SQ/Quote_Info_tab/Product’),’(?i).AIR.’,true)

(?i) is for - ignore case


  

:slight_smile: Both your solution worked like a charm. kudos …

How to do it in mobile? Because I am working on Ipad testing. and I clicked dropdown menu but I could not get their info.

1 Like

tutku said:

How to do it in mobile? Because I am working on Ipad testing. and I clicked dropdown menu but I could not get their info.

i have the same problem. Any ideas?

tutku, Ann
try to bring your question to mobile part of forum … this thread is closed (had BA) so you have smaller chance to get right answer here…

Andrej Podhajský said:

tutku, Ann
try to bring your question to mobile part of forum … this thread is closed (had BA) so you have smaller chance to get right answer here…

ok,thanks!