0

I have a DOM element with the following unique attribute

ui-sref=".carts.cart({type:'agent'})" 

so I need to define a XPath for Selenium to find this element.

I can use

//li[contains(@ui-sref,"carts") and contains(@ui-sref,"agent")]

and it works fine.

Can I use something like

//li[contains(@ui-sref,"carts"*"agent")
the Tin Man
  • 158,662
  • 42
  • 215
  • 303
Prophet
  • 32,350
  • 22
  • 54
  • 79
  • 1
    See https://stackoverflow.com/questions/21405267/xpath-using-regex-in-contains-function – Ori Marko Oct 29 '18 at 17:48
  • Without Xpath, any element: `<[\w:]+(?=\s)(?=(?:[^>"']|"[^"]*"|'[^']*')*?\sui-sref\s*=\s*(?:(['"])(?:(?!\1)[\S\s])*?carts(?:(?!\1)[\S\s])*?agent(?:(?!\1)[\S\s])*\1))\s+(?:"[\S\s]*?"|'[\S\s]*?'|[^>]*?)+>` –  Oct 29 '18 at 21:03

0 Answers0