-3

I get above error for following 2 scripts, what could be reason.

*** Settings ***
Resource          resource.txt

*** Variables ***
@{ExpectedCookieValue}    selenium1234
@{ExtractedCookieValue}    ${Empty}

*** Test Cases ***
CookieTest
    Open Browser    http://www.google.com     ${Browser}
    Maximise Browser Window
    Add Cookie    SeleniumTest    selenium1234
    Get Cookie Value    SeleniumTest
    ${ExtractedCookieValue}    Get Cookie Value    SeleniumTest
    Log    "Extracted Cookie Value"
    Log    ${ExtractedCookieValue}
    Should Be Equal    ${ExtractedCookieValue}    ${ExpectedCookieValue}    'Cookie Should Be Equal'
    Close Browser

2nd Script

*** Settings ***
Resource          resource.txt

*** Test Cases ***
AlertTest
    Open Browser    http://www.seleniummaster.com/robotframeworktest/alerttest.html    ${Browser}
    Sleep    5s
    Click Button    name=alert_button
    Sleep    5s
    Alert Should Be Present    This is an alert box
    Close Browser
MattDMo
  • 100,794
  • 21
  • 241
  • 231
Maq Said
  • 55
  • 1
  • 4
  • 8
  • 2
    Could you maybe, I don't know, post the offending code, along with the **full text** of the traceback? – MattDMo Oct 29 '15 at 23:22
  • Welcome to StackOverflow. Please read and follow the posting guidelines in the help documentation. [MCVE](http://stackoverflow.com/help/mcve) applies here. We cannot effectively help you until you post your code and accurately describe the problem. – Prune Oct 29 '15 at 23:29
  • Your are not going to get any help without more details. – oden Oct 29 '15 at 23:42

2 Answers2

0

I had defined a List Variable instead of Scalar. Went to resource file and defined Scalar Variable ${Browser} Firefox and Removed the following List Variable @{Browser} Firefox

Maq Said
  • 55
  • 1
  • 4
  • 8
0

Context: Robot Framework 4.1 (Python 3.9.6 on win32)

Similar to what Maq Said noted re "list vs scalar" - I had same error while iterating in a FOR loop through a list which I had defined using ${listname}. When I changed notation to @{listname} ($ to @) I got no error, and contents were listed. Code below, super simple, I hope this note helps someone:

 FOR     ${each_item}    IN   @{element_attribute_list}  #list of href URLs
     log to console    "element ===>" ${each_item}
 END

OUTPUT:

"element ===>" https://www.example.org/terms-of-use
"element ===>" https://www.example.org/contact_us
"element ===>" https://www.example.org/group-sales
... etc ...

Also to help with clarity here is cross-reference post and excerpt from Stackoverflow, another instance: In Robot Framework, what is the difference between a List Variable and a Scalar Variable containing a list?

| @{list} =   | Create List | a | b | c |
| ${scalar} = | Create List | a | b | c |
Dave Parham
  • 13
  • 1
  • 5