How to use apostrophe (') in xpath while finding element using webdriver?

后端 未结 5 512
难免孤独
难免孤独 2020-12-18 19:32

I need to use apostrophe (\') in my xpath expression which i need to use in finding elements using webdriver

i need to use below Xpath expression

//         


        
5条回答
  •  -上瘾入骨i
    2020-12-18 19:46

    The Escape character usage does not serve the purpose. I tried the concatenation function and it worked like a charm. Please see the below xpath.

    tag: li Manager of Workflow Initiator's Manager /li

    Concatenate function and split the string as –

    concat('Manager of Workflow Initiator',"'",'s Manager')
    

    Single quote is kept in double quote while other characters are kept in single quotes..

    So XPath looks as –

    //li[.=concat('Manager of Workflow Initiator',"'",'s Manager')]
    

提交回复
热议问题