Hello,
I have a problem with a piece of code and I need help 
Here is my code :
${elements}= Get WebElements //div[1]/inotr-bloc-annonce
FOR ${element} IN @{elements}
Log ${element}
Element Attribute Value Should Be ${element} data-transaction VENTE
END
My goal is to verify that ādata-transactionā attribute can have either āVENTEā value or āXXā value or āYYā value.
I try to insert a āORā condition inside de āFORā loop but it doesnāt work.
Thanks for your help !
Hi John,
How about this approach using List Should Contain Value:
@{ValidDataTransactions}= Create List VENTE XX YY
${DataTransaction}= Get Element Attribute ${element} data-transaction
List Should Contain Value @{ValidDataTransactions} ${DataTransaction}
Dave.
Hi Dave,
Thanks for your answer.
Do you mean an approach like this :
@{ValidDataTransactions}= Create List VENTE XX YY
${elements}= Get WebElements //div[1]/inotr-bloc-annonce
FOR ${element} IN @{elements}
Log ${element}
${DataTransaction}= Get Element Attribute ${element} data-transaction
List Should Contain Value @{ValidDataTransactions} ${DataTransaction}
END
I try it but I have an error (Keyword āCollections.List Should Contain Valueā expected 2 to 3 arguments, got 4.). Perhaps I have a bad construction of my code ?
Hi John,
Yeah thatās the idea, try changing the @ to a $ on the List Should Contain Value line:
List Should Contain Value ${ValidDataTransactions} ${DataTransaction}
Sometimes RF wants it one way and sometimes the other, iām never really quite sure, I just try it and if I get an error I try the other way, same thing with dictionaries (swap & and $).
Dave.
1 Like
Youāre alright. Iāve already seen this kind of āproblemā but I forgotā¦
Indeed, the result is now correct 
Thanks a lot !
A last question : do you know why I have a warning near the āList Should Contain Valueā line saying : Keyword āList Should Contain Valueā is from a library nested a resource file ?
Hi John,
List Should Contain Value comes from the Collections Library, you should include:
*** Settings ***
Library Collections
in your robot file, it must be in another robot file that you included in this robot file so thatās how itās picking it up, but giving you a warning because itās not in this robot file.
when ever you use a keyword that is not from the builtin library, you should add that library to your robot file.
Dave.
Ok, I thought that when I use Standard Librairies, Itās useless to put it on āSettingsā section.
Thanks to you, I know that itās usefull only for keywords which are not in āBuiltInā library !
Thanks again 