selenese-runner-java icon indicating copy to clipboard operation
selenese-runner-java copied to clipboard

Is it support template literals?

Open zhiburt opened this issue 3 years ago • 4 comments

Hey there, as I see when we have this command

{
      "id": "87663521-6dd0-432f-9f85-84d9eebb7806",
      "comment": "",
      "command": "executeScript",
      "target": "let bar = \"123\"; return `${bar} hello`",
      "targets": [],
      "value": "seller_url"
    }, 

In selenium and in your runner the result is different

Selenese

[2020-11-13 20:04:22.297 +03:00] [INFO] <4> Command#4: executeScript("let bar = \"123\"; return `${bar} hello`", "seller_url")
[2020-11-13 20:04:22.328 +03:00] [INFO] - [null hello]

Selenium-IDE

image

It will be fair to say that I've been developing a similar tool as selenese for a while and bump into the same issue :( I didn't know about existent of this repo before.

Thanks for selenese

ref: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals

zhiburt avatar Nov 13 '20 17:11 zhiburt

I fixed this problem and released version 3.33.0. Please test it.

vmi avatar Dec 08 '20 16:12 vmi

Hey @vmi I've review your changes it's seems to work :+1:

I would only mention in a doc comment for replaceVars that it prioritize selenium vars after js vars if the names are the same.

zhiburt avatar Jun 11 '21 11:06 zhiburt

Actually there's a major change in your code isn't it? In case if variable isn't present in environment there will be not emitted anything but for example in Selenium IDE as I remember it emits empty string.

zhiburt avatar Jun 11 '21 12:06 zhiburt

In case if variable isn't present in environment there will be not emitted anything but for example in Selenium IDE as I remember it emits empty string.

Ultimately I was wrong I guess.

But it will be interesting to hear you according to it

zhiburt avatar Jun 11 '21 12:06 zhiburt