Forum Discussion

jack_edwards's avatar
jack_edwards
Occasional Contributor
9 years ago

Using FindChildByXPath with apostrophe in XPath

TC11 Documentation:  https://support.smartbear.com/viewarticle/72332/   Hello,   We have used FindChildByXPath successfully in the past, but are having an issue when the XPath contains an apostro...
  • HKosova's avatar
    9 years ago

    Hi Jack,

     

    If a value contains apostrophes, you need to wrap it in quotes instead of apostrophes:

    Value = "A Midsummer Night's Dream"
    TempStr = "//*[@title=" & Chr(34) & Value & Chr(34) & "]"
    
    ' This is the same as TempStr = "//*[@title=""A Midsummer Night's Dream""]"