Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot use variables in Selenium IDE #1690

Closed
Lumios64 opened this issue Aug 9, 2023 · 15 comments
Closed

Cannot use variables in Selenium IDE #1690

Lumios64 opened this issue Aug 9, 2023 · 15 comments

Comments

@Lumios64
Copy link

Lumios64 commented Aug 9, 2023

💥 Regression Report

A clear and concise description of what the regression is.

The keyword to call variables ${} is no longer recognized by Selenium, and is treated as a string of text instead.
Encountered this issue while testing an automated bot after following a tutorial.

Last working version

Worked up to version:
Unknown given I haven't used Selenium up until recently, but based on third-party sources, it worked at least until 02/28/2023.
https://learn.microsoft.com/en-us/power-automate/desktop-flows/inputs-outputs-web
https://www.ibm.com/docs/en/cloud-app-management/2019.3.0?topic=test-passing-variable-values-selenium-script

Stopped working in version:
3.17.4

To Reproduce

Steps to reproduce the behavior:

Add a store command with a target variable and a number of your choice, then an echo command that is supposed to call the variable.
Like so :

Command|Target|Value
store | number | 1
echo |${number}|

In the example above, the output is "${number}".

Screenshot_20230808_141429

Expected behavior

A clear and concise description of what you expected to happen.

The echo command should return the number "1".

Project file reproducing this issue (highly encouraged)

Please provide a project file .side that reproduces this issue.

Github would not let me post the file, so I changed the filetype to txt.
probtrimmed.txt

It was trimmed down to include only the code that errored, and I added comments to describe what the code does.

Environment

OS: Ubuntu Studio 22.04
Selenium IDE Version: 3.17.4
Selenium SIDE Runner Version: None, using only the WebExtension
Node version: None
Browser: Firefox
Browser Version: 115.0.2 (64-bit)

@Pun-slinger
Copy link

Pun-slinger commented Aug 9, 2023

v4 of Selenium IDE and selenium-side-runner is also facing this problem then it comes to asserting. Only the "Assert" command is spared from this issue

@toddtarsi
Copy link
Contributor

@Pun-slinger - Thanks for letting me know. Easy fix. 😄
@Lumios64 - The v3 IDE hasn't changed in a very long time. I'd be surprised if variable processing was completely broken.

@toddtarsi
Copy link
Contributor

@Pun-slinger - Okay, so around here in this file:

WebDriverExecutor.prototype.doAssert = composePreprocessors(

We do all of this composePreprocessors garbage. Basically, the first argument is target, the second argument is value. Which asserts are you not seeing this on, and is it not swapping on target or value? Basically, wherever its missing, I'll just replace null with interpolateString and cut a release.

@Pun-slinger
Copy link

Pun-slinger commented Aug 10, 2023

@toddtarsi it's missing on pretty much every asserts aside from Assert command (title, value, text, selected label, selected value, element present, etc...), and from what I could tell, it's not swapping on both target and value

@toddtarsi
Copy link
Contributor

@Pun-slinger - I added some of them in this commit:

747b343#diff-9e4aa485e596920bbae5fa60cfc15763794c4d5bfb1801ae935cf450fb4c61ff

Let me know if this helps for a few of them and we can just keep adding the things.

@Pun-slinger
Copy link

Pun-slinger commented Aug 10, 2023

@Pun-slinger yep, they all worked. "Times" command is having the same issue so that should be next to be added

Edit: Assert Selected Label need added

@toddtarsi
Copy link
Contributor

@Pun-slinger - Added, thanks!

@toddtarsi
Copy link
Contributor

@Lumios64 - I'm not sure whats going on there, but I'd be happy to resolve any experiences of this in v4 alpha:

https://github.com/SeleniumHQ/selenium-ide/releases/tag/latest

@toddtarsi toddtarsi reopened this Aug 12, 2023
@toddtarsi
Copy link
Contributor

@Lumios64 - I'll leave the issue open for now, and if I don't hear from you for a while, I'll close it.

@Lumios64
Copy link
Author

Good afternoon, I have a question. If variable processing couldn't possibly be malfunctioning, then I must be missing something. The documentation has not been very helpful either, it doesn't explain the most basic features of Selenium and only offers rudimentary examples of code which has only heightened my frustration with this problem.

Do I have to install SIDE Runner or Node to use variables? If it should be possible to use variables without either, then something else must have gone wrong.

@toddtarsi
Copy link
Contributor

@Lumios64 - I primarily maintain v4. It might be that v3 doesn't have string interpolation enabled for this command.

Looking at the source here, I see it on for the value on send keys:

https://github.com/SeleniumHQ/selenium-ide/blob/v3/packages/selianize/src/command.js#L374

But then I don't see an equivalent for the arguments on emit echo. So, it won't log the substituted variables when you echo.
If you're using v4, I'd be happy to fix it. Otherwise, I'm not really interested.

https://github.com/SeleniumHQ/selenium-ide/releases/tag/latest

@Lumios64
Copy link
Author

Sorry for not replying sooner. As I said on my issue, the version I use is 3.17.4 on Firefox, I didn't know it was deprecated because I downloaded it off Mozilla's addon store and it is still the latest version to this day.

I do not like using Nightly builds of programs I rely on because they may have bugs. It's cool if that issue was resolved in version 4, I believe you when you say string interpolation might be the problem.

I will wait until version 4 has been fully-fledged and is ready to be distributed onto the Mozilla store and Google's webstore. My browser is set to automatically download any new update for my extensions to keep them up-to-date.

@toddtarsi
Copy link
Contributor

Totally, but the problem is that manifest v3 is a required webextension permission model change that disables arbitrary code execution in webextensions. That means your user-provided strings like executeScript and assert can't be evaluated or executed anymore. So, v4 isn't going to be a webextension. It can't be. It's an electron binary written for desktops, which basically means its a small custom browser + a small custom website that tells electron to do the internal bits here.

@toddtarsi
Copy link
Contributor

And manifest v2 is deprecated, so I'm not really sure what I can do for you here 🤷

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked and limited conversation to collaborators Sep 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants