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

后端 未结 5 513
难免孤独
难免孤独 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条回答
  •  Happy的楠姐
    2020-12-18 19:54

    I Encountered a similar situation where I need to write an xpath for an element shown below:

    Element:

    
    

    I was able to grep the element using below Xpath, where I used the backslash to escape the characters [ and ".

    Xpath : //img[@data-ctl='\[\"DatePicker\"\]']

    Hope this helps.

提交回复
热议问题