Javascript from Selenium IDEnot playing nice in Kantu


#1

2 questions. assuming my id is this: “ctl00_gvAccountTeam_ctl07_txtOrder”

#1 when I store it in owner_id (see below) I can see that attribute assigned to that variable in the variables tab in Kantu. But then echo it in the next command, and I get a “variable OWNER_ID is not defined”. What am I doing wrong?

#2 I’m trying to trim off “_txtOrder” from owner_id, but running into errors. I did this in Selenium IDE this way:
STORE | javascript{storedVars[‘owner_id’].substring(0,storedVars[‘owner_id’].indexOf("_txtOrder"));} | trimmed_id. I fiddled with it below, and can’t get anywhere.

#3 BONUS question. I also need to trim “ctl00_gvAccountTeam_ctl” off the front of the string - leaving only “07”. i had a working solution in Selenium, but not having luck with porting it over to Kantu.
Thanks a bunch!
KUSM

{
“Command”: “storeAttribute”,
“Target”: “xpath=(//a[contains(text(),‘Unknown, Owner’)])@id”,
“Value”: “owner_id”
},
{
“Command”: “echo”,
“Target”: “${owner_id}”,
“Value”: “”
},
{
“Command”: “storeEval”,
“Target”: “'javascript{storedVars[‘owner_id’].substring(0,storedVars[‘owner_id’].indexOf(”_txtOrder"));}",
“Value”: “before_location_number”


#2

In what version of Selenium IDE does this code work?

Normally in storeEval you do not need “javascript{…}”.

Does it work without this? => just use storedVars[‘owner_id’].substring(0,storedVars[‘owner_id’].indexOf(”_txtOrder"));)


#3

it worked up to the sad end of the old Selenium IDE. Yes that code does work, Thanks much! :-):smiley: