selenium-ide: 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.

image

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)

About this issue

  • Original URL
  • State: open
  • Created 5 years ago
  • Reactions: 2
  • Comments: 16 (5 by maintainers)

Most upvoted comments

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 grafik

This is the command grafik 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

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.

image

@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