Robot Framework how to get the values from list variable

Viewed 791

I'm using robotframewok 4.0

I have defined a simple list variable:

*** Variables ***
${BROWSERSIZE}   1400   900

Using this variable in a test case:

Log To Console    Size: ${BROWSERSIZE}, Width:${BROWSERSIZE}[0] Height:${BROWSERSIZE}[1]

the output is this:

Size: 1400 900, Width:1 Height:4

Shouldn't (according to the manual) the indexes [0] and [1] refer to the two values? Instead it seems they refer to the character...

What am I doing wrong?

1 Answers

You are declaring your variable as a scalar instead of as a list. When you indexing it, you are indexing a string,[0] is the first character 1, [1] is the second character 4.

Change $ to @ to declare the variable as list.

*** Variables ***
@{BROWSERSIZE}   1400   900
Related