# Issue selecting a value from a variable using an argument

**URL:** <https://forum.robotframework.org/t/issue-selecting-a-value-from-a-variable-using-an-argument/3483>\
**Category:** Robot Framework\
**Created:** [25 March 2022 16:05 UTC](https://forum.robotframework.org/t/issue-selecting-a-value-from-a-variable-using-an-argument/3483 "2022-03-25T16:05:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bweston](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/bweston/32/1298_2.png) [@bweston](https://forum.robotframework.org/u/bweston)\
**Post date:** [25 March 2022 16:05 UTC](https://forum.robotframework.org/t/issue-selecting-a-value-from-a-variable-using-an-argument/3483/1 "2022-03-25T16:05:13Z")

</div>

I wish to select a value in a variable based on the arguments in my test case. I believe I have a syntax or keyword error but I am unable to resolve. Does the error mean I am not using the correct syntax or does it mean I am not using the correct keyword? Let me know if more information is required in order to better assist. I am very new to auto testing so I am sure it could be a variety of issues.

Select Organization  
[Arguments] ${org[0]}  
click element //_[@id=“mat-select-value-11”]  
sleep 2s  
mouse over //_[@id=“mat-option-33”]  
sleep 2s  
click element ${org[0]}

My desire in this case is that value A is selected. I assume if I used click element ${org[1]} then B is selected etc…

${ORGANIZATIONS}= A B C D E F

Error:  
Element with locator ‘A B C D E F’ not found.

---

<div class="post-metadata">

**Author:** ![HelioGuilherme66](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/helioguilherme66/32/34_2.png) [@HelioGuilherme66](https://forum.robotframework.org/u/HelioGuilherme66)\
**Post date:** [25 March 2022 17:25 UTC](https://forum.robotframework.org/t/issue-selecting-a-value-from-a-variable-using-an-argument/3483/2 "2022-03-25T17:25:19Z")

</div>

> [@bweston](#):
>
> [Arguments] ${org[0]}

In practice this is the same as defining a variable named `${org[0]}` so that is why you get all the elements when clicking.

You should use `[Arguments] ${org}`

---

<div class="post-metadata">

**Author:** ![bweston](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/bweston/32/1298_2.png) [@bweston](https://forum.robotframework.org/u/bweston)\
**Post date:** [25 March 2022 18:04 UTC](https://forum.robotframework.org/t/issue-selecting-a-value-from-a-variable-using-an-argument/3483/3 "2022-03-25T18:04:25Z")

</div>

I tried but now I get a different error. I will place my entire test case to better show all the code.

\*\*\* Test Cases \*\*\*  
Create a new Additional Cost  
[Tags] Functional

```
Successfully access login page
Input valid Username or Password ${USERNAME} ${PASSWORD}
Select Profile Icon
Open Additional Cost
Click New Additional Cost
Select Organization

```

\*\*\* Keywords \*\*\*  
Select Organization  
[Arguments] ${org}  
click element //_[@id=“mat-select-value-11”]  
sleep 2s  
mouse over //_[@id=“mat-option-33”]  
#//\*[@id=“mat-option-61”]/span  
sleep 2s  
click element ${org}

This test case file references another data file with these values:

\*\*\* Variables \*\*\*  
#Organizations

${ORGANIZATIONS}= A B C D E F

Error received:  
Keyword ‘Select Organization’ expected 1 argument, got 0

---

<div class="post-metadata">

**Author:** ![HelioGuilherme66](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/helioguilherme66/32/34_2.png) [@HelioGuilherme66](https://forum.robotframework.org/u/HelioGuilherme66)\
**Post date:** [25 March 2022 18:15 UTC](https://forum.robotframework.org/t/issue-selecting-a-value-from-a-variable-using-an-argument/3483/4 "2022-03-25T18:15:09Z")

</div>

> [@bweston](#):
>
> click element ${org[0]}

Well, I did not mention a change on this line. It was correct 🙂
