WebUI.selectOptionByValue using variable not working

Hello,

Im trying to use a variable when like this: WebUI.selectOptionByValue(findTestObject(‘Object Repository/Page_SESAM 2/selectidctl00_MC_SGOrder_ddlAdresses (7)’), GlobalVariable.kundAdress, false)

And it wont wrk i get error:
10-11-2019 04:28:13 em selectOptionByValue(findTestObject(“Object Repository/Page_SESAM 2/selectidctl00_MC_SGOrder_ddlAdresses (7)”), Namn, false)

But when i put in the value myself/hardcore in the SelectOption it will select and find it perfect.
This work:
WebUI.selectOptionByValue(findTestObject(‘Object Repository/Page_SESAM 2/selectidctl00_MC_SGOrder_ddlAdresses (7)’), “adress”, false)

Anyone know why i cant use the variable ? when i print it out it looks exactly the same, same spaces and everything, nothing is diffrent, but still it wont work.

Would love some help with this.

Thanks

hello,

not sure, if you have to convert it to the String like GlobalVariable.kundAdress.toString()
or you can get this Global variable to String object
String val = GlobalVariable.kundAdress
print val //is this null???
WebUI.selectOptionByValue(findTestObject(‘Object Repository/Page_SESAM 2/selectidctl00_MC_SGOrder_ddlAdresses (7)’), val, false)

one more is this imported
import internal.GlobalVariable as GlobalVariable

1 Like

i did solve this problem.
the site did add space when i fetched the data and solve with by removing all spaces, when i store it