Devi
Devi

Reputation: 9

How to use user created variable in the same Test Case later in Robot Framework?

I am new to RF. I want to use user created variable later in the test case. First I assigned value to a variable ${PL_VIN} using keyword "Get Text". Now I want to input this value to a text box.In "Output.xml" file I am able to see that the value is assigned to ${PL_VIN}.But when using it later i am getting error that "Variable not found". Do i need to add this user created variable to Locators file?

Script:

Assigned value as below:

${PL_VIN} = Get Text    ${VIN_Search Result_Title_WO_Acc_Info}

Using it later in the same test case as below:

Input Text  ${VIN_Test Box_Wrk_Dup_Title_WQ}    ${PL_VIN}

Output in output.xml

When Getting text:

msg level="INFO" timestamp="20150624 23:13:22.561">${PL_VIN} = SED1T0751ES624687</msg>

When using it later:

Variable '${PL_VIN}' not found. Did you mean: ${BPO_Link}

Upvotes: 0

Views: 2156

Answers (1)

W&#252;rgspa&#223;
W&#252;rgspa&#223;

Reputation: 4840

I think your line with varaible assignment misses a tabulator and output.xml just prints the line of source code.

Try

${PL_VIN} =    Get Text    ${VIN_Search Result_Title_WO_Acc_Info}
Log To Console    ${PL_VIN}    # just for debugging

if that does not work, the problem is the implementation of Get Text. It is not a built-in keyword but probably from selenium2library. If so, make sure that SED1T0751ES624687 (the value ${VIN_Search Result_Title_WO_Acc_Info} apparently resolves to) is a valid locator and check the whole output of output.xml for other error messages.

Upvotes: 1

Related Questions