Need xpath syntax help: contains() with COL1


#1

I am reading a CSV file with serial numbers.

For serial number “1207860082”, if I hard code the serial number into xpath it finds the correct element on the page:
{
“Command”: “click”,
“Target”: “xpath=//tr[contains(*,“1207860082”]//input”,
“Value”: “”
},

But when I’m reading serial numbers from a CSV file, and I have !COL1 with value “1207860082”, I can’t seem to get the syntax right. I am a newbie so am just trying to follow examples. I don’t really understand $, {, and ! when applied to internal variables. I have tried:
{
“Command”: “click”,
“Target”: “xpath=//tr[contains(*,${!COL1}]//input”,
“Value”: “”
},
but this doesn’t find the element. Instead of ${!COL1} I have tried variations like
!COL1
COL1
${COL1}

The segment of the page I am working with:

Card #1201296458 - 'JH Card'
Card #1201296459 - 'SR Card'
Card #1207988827
Card #1207860082

QUESTION: What is the proper xpath syntax?


#4

Sorry, image of the segment of the page I am working on:


#5

SOLUTION:
xpath=//tr[contains(*,"${!COL1}")]//input

The missing parts were the double quotes surrounding ${!COL1}