How to run a list of special characters input check via CSV?


#1

Hi
2 quick questions:

ITEM 1:
I have a list of Special Characters

!@#$%^&*()_±={}[]:";’<>?,./

to test for many fields.

I am thinking about using CSV and go 1 character at a time by reading the “string”?
But from here: https://a9t9.com/kantu/docs/selenium-ide/csvread it seems that I need to seperate each characters into a different column. Do I really have to? Can I run it like a “String” array to read each special character?

(Thinking as it will be easier to manage the test scripts also, rather than having to write new or update existing macro for ${!COL##} when there are more symbolic characters to test.)

ITEM 2:
How to write the code to repeatedly (i.e. looping) test each special character for each fields across several different pages?

Can advise please on the above 2 items?

(Apologies, the original Kantu tutorial sample macros were removed as the macro list ran too long and our team was cleaning up the list and removed the all of the tutoria includingl “DemocsvRead”…)


#2

Just to clarify the first task: You have a list of characters like !@#$%^&*()_±={}[]:";’<>?,./ and then want to insert

  • ! in the 1st run
  • @ in the 2nd run
  • # in the 3rd run?

If so, here is code for that (no CSV needed). It is from DemoStoreEval:

   {
      "Command": "storeEval",
      "Target": "new Array ('cat','dog','fish','dog','??','frog','?','dog','??','horse','??elephant')",
      "Value": "names"
    },
    {
      "Command": "storeEval",
      "Target": "storedVars['names'].length",
      "Value": "length"
    },
    {
      "Command": "echo",
      "Target": "array length = ${length}",
      "Value": ""
    },
    {
      "Command": "storeEval",
      "Target": "Math.floor(Math.random()*storedVars['length'])",
      "Value": "num"
    },
    {
      "Command": "echo",
      "Target": "num=${num}",
      "Value": ""
    },
    {
      "Command": "echo",
      "Target": "The next command picks the random item",
      "Value": ""
    },
    {
      "Command": "storeEval",
      "Target": "storedVars['names'][${num}]",
      "Value": "myrandomname"
    },
    {
      "Command": "store",
      "Target": "Today is ${mydate}, and we draw a ${myrandomname}",
      "Value": "output"
    },

It picks the item randomly, but of course you can replace the “num” var e.g. with ${!loop}.

2nd question: Once the value is in “myrandomname” just use this var wherever you need it.


#3

Many thanks for the prompt support :slight_smile:

Yes you are very correct on my 1st task requirement :smiley:

Sry mind a quick answer to the below?
As googling “Kanta escape character” does not return me the expected results,

Need help with the special character input:
` Grave Accent
’ Single Quote
" Double Quote
\ Front Slash


#4

Kantu escape characters => same as Javascript escape characters:

JavaScript uses the \ (backslash) as an escape characters for:

  • \' single quote
  • \" double quote
  • \\ backslash
  • \n new line
  • \r carriage return
  • \t tab
  • \b backspace
  • \f form feed
  • \v vertical tab (IE < 9 treats ‘\v’ as ‘v’ instead of a vertical tab (’\x0B’). If cross-browser compatibility is a concern, use \x0B instead of \v.)
  • \0 null character (U+0000 NULL) (only if the next character is not a decimal digit; else it’s an octal escape sequence)

I copied this list from here.


#5

Oh wOAH, Many Thank You for the outstanding support !!!

Double Thumbs up!