SeleniumHQ / selenium-ide

Open Source record and playback test automation for the web.
https://selenium.dev/selenium-ide/
Apache License 2.0
2.72k stars 739 forks source link

Variables aren't recognized in Assert Text and Assert Not Text #1836

Open edvinjunda opened 4 weeks ago

edvinjunda commented 4 weeks ago

🐛 Bug Report

Assert Text and Assert Not Text don't recognize variables written in target xpath in following way: "xpath=//div[${variable}]" same like in this issue I think https://github.com/SeleniumHQ/selenium-ide/issues/1690. Error text: "invalid selector: Unable to locate an element with the xpath expression /html/body/div[1]/div[3]/div/div/div[3]/div/div/div[${i}]/div/div/div/div[2]/div[8] because of the following error: SyntaxError: Failed to execute 'evaluate' on 'Document': The string '/html/body/div[1]/div[3]/div/div/div[3]/div/div/div[${i}]/div/div/div/div[2]/div[8]' is not a valid XPath expression.".

To Reproduce

Use variable in target xpath with Assert Text and Assert Not Text commands.

Expected behavior

Variables are available for use in those commands target xpaths without problems.

Project file reproducing this issue (highly encouraged)

Just use Assert Text and Assert Not Text commands which have variable written in target xpath.

Environment

OS: Windows 10 OS Selenium IDE Version: 4.0.1-beta.12 Browser: Google Chrome

toddtarsi commented 4 weeks ago

Ah! My mistake, will fix later tonight. For the moment, you can work around this with wait for text / not text

toddtarsi commented 4 weeks ago

@edvinjunda - Okay, I checked out the assert stuff. I think assert text is looking okay. For the other assert commands, a TON of them were missing preprocessors, so I went through and added those back. Honestly, I think in v5, I'm going to have a migrate script to collapse all assert and verify commands into the waitFor variants. I think having a smaller set of hardened commands will be better for users.

Screenshot 2024-06-05 at 4 21 36 AM
toddtarsi commented 3 weeks ago

@edvinjunda - Alright, new version is going up for testing here. Will probably just release after CI passes

https://github.com/SeleniumHQ/selenium-ide/pull/1837