lundi 31 août 2020

Robot Framework Variable Attribute In Seperate File Not Storing Attribute To Be Used ElseWhere

Variable attribute not getting passed into other file.

I have my variables for element locators stored in one file and I have assertions done in another file which has worked fine until now and separates things out nicely. I am doing an assertion to check that an element exists and its attribute(value) is not blank. If I write it on one page as follows it works perfectly. This use the selenium library keywords should not be equal and get data attribute just to note.

${EXAMPLE}  get data attribute  class=test test-data
should not be equal  ${EXAMPLE}  ${EMPTY}

But If I separate them out into different files. So a locators.robot file:

 #Locater File
 ${EXAMPLE}  get data attribute  class=test[test-data]

And an Assertions.robot:

 #Assertion File
 should not be equal  ${EXAMPLE}  ${EMPTY}

It stops working. If I use a selenium library assertion like page should contain element then it works, so I know I am pulling in the other Resource correctly. I have a feeling I may need to store the attribute in another variable somehow and actually assert against that. Any ideas would be great. Thanks in advance.

Aucun commentaire:

Enregistrer un commentaire