selenium-ide
selenium-ide copied to clipboard
Command store text causes errors when text contains some HTML tags
🐛 Bug Report
When I use the command store text to store a text of any element of a web page , and if that text contains some HTML tags like p or br , then I get an error later in the code. The error is not at the level of the command store text itself. The errors rather appears later when using the storage variable. If I try anything on the storage variable, except the echo command, it will cause the following error : Failed: Unexpected token in JSON at position XX where XX is the character index of br or p in the string.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
I expected the text to be stored without the HTML tags. I expected Selenium IDE to omit those HTML tags, or at least no error.
Project file reproducing this issue (highly encouraged)
Please provide a project file .side that reproduces this issue.

Issues without a reproduction project are likely to stall.
Environment
OS: Windows 10 Selenium IDE Version: 3.14.0 Selenium SIDE Runner Version: Node version: Browser: Browser Version: Google Chrome 78.0.3904.87 (Official Build) (64 bits)
I have exactly the same issue bothering me for a while. I am new in Selenium IDE.
This issue has stalled, unfortunately.
It would be really helpful if you could provide a reproducible test case as a SIDE file attached in the issue.
@tourdedave It says :
"We don't support that file type. Try again with a GIF, JPEG, JPG, PNG, DOCX, GZ, LOG, PDF, PPTX, TXT, XLSX or ZIP."
That is why I included a screenshot instead of a SIDE in my post.

You can rename the file extension and upload it.
On Wed, 25 Dec 2019 at 2:35 YecineM [email protected] wrote:
@tourdedave https://github.com/tourdedave It says : "We don't support that file type. Try again with a GIF, JPEG, JPG, PNG, DOCX, GZ, LOG, PDF, PPTX, TXT, XLSX or ZIP." That is why I included a screenshot instead in my post.
— You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/SeleniumHQ/selenium-ide/issues/866?email_source=notifications&email_token=AADPTMJMUSJTYEGVRGYXYS3Q2KTEDA5CNFSM4JKL3NB2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEHTWWBY#issuecomment-568814343, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADPTML3SQV5NNY7RWY4APTQ2KTEDANCNFSM4JKL3NBQ .
Okay, thank you.
Here we go :

@YecineM That didn't appear to work. Try zipping it again and renaming it to a non-file format, like .zzz.
@tourdedave Thanks for your patience, but it worked for me.. I downloaded my former link and renamed its extension back to .side , and it worked ! However, here is a zipped .zzz, as you suggested : store_text.zip
I haven’t had a chance to review it yet. I’ll respond when I have. Thanks!
On Wed, 8 Jan 2020 at 20:40 YecineM [email protected] wrote:
Is the reproducer not good ?
— You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/SeleniumHQ/selenium-ide/issues/866?email_source=notifications&email_token=AADPTMKFPDJWIK5RXPRDWQ3Q4YM2FA5CNFSM4JKL3NB2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEINRR3Q#issuecomment-572201198, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADPTMNXFTMWUTKUXK2FAJ3Q4YM2FANCNFSM4JKL3NBQ .
Well thank you too, developers !
@YecineM Please be aware that this project is an open source project, so the developers are working on this project on there leisure time ...
i can confirm this issue, i can not use this Variable it always throws this error
Hi together,
I have the same problem with Selenium IDE on Chrome.
I am getting the text behind the menu item with the below command (the item is organized two lines of text with different formatting)
This the GUI item

This is the command
grafik

I am able to echo it as: "echo Logged in to the following account: ${account}" showing the text of account correctly
But any other command also "exec script" when using this variable as ${account} will throw an error "unexpected token in json at position 25" - I guess at position 25 in the string there shall be any html character causing this trouble (maybe an html tag?).
So it appears that the old problem described on 07.11.2019 is still present.
It would be good if it could be removed as getting text of more complex items that "flat text" shall be a common approach.
BR
Marek
.side project attached to be able to reproduce the issue:
feb406f9-1a62-427e-b052-f10db2405d9a.zip
{ "id": "78de61ba-addc-491c-87dc-eaadb382ae5a", "version": "2.0", "name": "test", "url": "https://github.com", "tests": [{ "id": "7327e477-e1c4-4058-939c-168659b1a71d", "name": "reproductionIssue866", "commands": [{ "id": "57c8c367-cb77-49e4-a8a3-b0fda86eea8b", "comment": "", "command": "open", "target": "/SeleniumHQ/selenium-ide/issues/866", "targets": [], "value": "" }, { "id": "822c5f71-317e-4a86-a98b-a5e0bdc2b79f", "comment": "", "command": "storeText", "target": "css=#issue-519450358 p:nth-child(2)", "targets": [], "value": "storedtext" }, { "id": "1fd07487-4bf5-433d-8a2e-7564e783830a", "comment": "", "command": "echo", "target": "${storedtext}", "targets": [], "value": "" }, { "id": "b60625f4-97a5-496c-a382-9cd5ed9ac0ca", "comment": "", "command": "executeScript", "target": "var storedtext = ${storedtext}; return storedtext;", "targets": [], "value": "newstoredtext" }] }], "suites": [{ "id": "3692f1b1-8023-4e49-8476-9d0bf9bd7650", "name": "Default Suite", "persistSession": false, "parallel": false, "timeout": 300, "tests": ["7327e477-e1c4-4058-939c-168659b1a71d"] }], "urls": ["https://github.com/SeleniumHQ/selenium-ide/issues/866", "https://github.com/"], "plugins": [] }
Hey @YecineM, I have the same problem an I use store attribute as a workaround. If you want to check an specific text and you have access to the HTML maybe you can add the html standard attribute "data-*" with your specific text as a content.

Same for me, problem still exists... Any chance to get it corrected? ☺
@skump123 - Is this still an issue in v4?
https://github.com/SeleniumHQ/selenium-ide/releases/tag/v4.0.1-alpha.99