what is xpath for ItemCode="J" AIR FILLED CYLINDERS DDDFDF ''@#

Issue

<td role="gridcell" style="" title="'J' AIR FILLED CYLINDERS DDDFDF ''@#" aria-describedby="item_grid_ItemCode" class="edit-cell ui-state-highlight">"J" AIR FILLED CYLINDERS DDDFDF ''@#</td>

ItemCode="J" AIR FILLED CYLINDERS DDDFDF ”@#

tried below xpath which didn’t worked

1. //td[text()=\""+ItemCode+"\"]
2. //td[text()=\'"+ItemCode+"\']

Solution

Your usecase is quite tricky.

Depending on which scraping language you use, maybe(I’m not able to test in the moment) use something like this (example JavaScript):

let xpath = '//td[text()=concat(\'"J" AIR FILLED CYLINDERS DDDFDF \',"\'\'\'\'@#") ]';

This wil construct this XPath:

//td[text()=concat('"J" AIR FILLED CYLINDERS DDDFDF ',"''''@#") ]

Meaning: in the case that there is a combi of single or double quotes in your ItemCode you have to build a XPath using the XPath-concat() function.

See these answers answer and this answer and this question.

Answered By – Siebe Jongebloed

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published