selenium-ide icon indicating copy to clipboard operation
selenium-ide copied to clipboard

storedVars not defined

Open cinnest opened this issue 8 years ago • 6 comments

After creating a new code a message is shown like: "transaction code: 1234". This code is then shown in a table with a list of transactions. For validating it on this table I'd like storing just the substring "1234". I've tried the following but I always get a message the storedVars is not defined.

{
"id": "b64d23c7-72af-48f2-957a-3929281cb2ec",
"comment": "",
"command": "storeText",
"target": "css=span.ui-messages-summary.ng-star-inserted",
"value": "trxCodeMsg"
}, {
"id": "0365bcc1-d263-4417-829d-da68debd2c20",
"comment": "",
"command": "executeScript",
"target": "return storedVars['trxCodeMsg'].substring(18,22)",
"value": "trxCode"
}

Current behavior

  1. storeText on css=span.ui-messages-summary.ng-star-inserted with value trxCodeMsg... OK
  2. executeScript on return storedVars['trxCodeMsg'].substring(18,22)... Failed: storedVars is not defined 'CreateAndVerifyCode' was aborted

Environment

OS: Windows 7 Selenium IDE Version: 3.1.0 Browser: Firefox Quantum Browser Version: 61.0.1 (64-bit)

cinnest avatar Aug 01 '18 08:08 cinnest

storedVars is not accessible anymore like that, you'll have to use string interpolation as so:
executeScript | return ${trxCodeMsg}.substring(18,22) | trxCode.

corevo avatar Aug 01 '18 11:08 corevo

I've tried it too but then I get the following error: 10.executeScript on return ${trxCodeMsg}.substring(18,22)... Failed: unexpected token: identifier

cinnest avatar Aug 01 '18 12:08 cinnest

executeScript | return "${test}".substring(0,2) | something.
This works, but I'm not sure that this is the intended behavior, I had to convert it to string, I'll need to run some checks.

corevo avatar Aug 01 '18 12:08 corevo

It seems to work indeed. The validation is the one that fails now but would say that's another problem, right?

9.storeText on css=span.ui-messages-summary.ng-star-inserted with value trxCodeMsg... OK
10.executeScript on return "${trxCodeMsg}".substring(18,22) with value trxCode... OK
echo: trxCode=[0633]
12.clickAt on //button[@type='button'] with value 138,22... OK
13.clickAt on //board/div/div[2]/span with value 50,10... OK
14.verifyText on //table with value *${trxCode}*... Failed:
Actual value 'Last name First name Transaction Code Validity Stegmann Anka 3496 00:59:25 Stegmann Anka 0633 00:59:56' did not match '*0633*'
{
      "id": "f03b3231-c4b5-4326-909b-2f32239db347",
      "comment": "",
      "command": "executeScript",
      "target": "return \"${trxCodeMsg}\".substring(18,22)",
      "value": "trxCode"
    }, {
      "id": "15903171-3936-4eb9-bf95-4158df9f3ec3",
      "comment": "",
      "command": "echo",
      "target": "trxCode=[${trxCode}]",
      "value": ""
    }, {
      "id": "9cc43c79-1c5f-4c2e-b9f9-eecac8f35442",
      "comment": "",
      "command": "clickAt",
      "target": "//button[@type='button']",
      "value": "138,22"
    }, {
      "id": "f3a55d98-206d-4621-81d3-db0870407f6e",
      "comment": "",
      "command": "clickAt",
      "target": "//board/div/div[2]/span",
      "value": "50,10"
    }, {
      "id": "957fc9ad-3b30-4596-9718-04360a486dd1",
      "comment": "",
      "command": "verifyText",
      "target": "//table",
      "value": "*${trxCode}*"
    }

cinnest avatar Aug 01 '18 13:08 cinnest

Although I'd appreciate a help with the verfiyText the main point of this issue was solved, so I'm closing it. Thanks @corevo for your help.

cinnest avatar Aug 02 '18 06:08 cinnest

That issue is tracked at #141

corevo avatar Aug 02 '18 07:08 corevo