0

Given this element :

<div class="block-level-tooltip color_title ellipsis-tooltip" title="RATE">RED Infinity 25 Rate</div>

I'm trying to do a xpath slector that is not case sensitive to title attribute value or text value that contains the word 'rate'

What I've tried, but dosen't seem to find anything:

P.S. Inspired by this post

//*[(contains(lower-case(@title), 'rate')) or (contains(lower-case(text()), 'rate'))]
Rolfsky
  • 63
  • 7
  • Give ["how to ask"](https://stackoverflow.com/help/how-to-ask) a read, it will help you improve your questions. – Arthur Morris Oct 21 '20 at 08:13
  • Ok, sure, but, did I miss any details that would help reproduce the request ? I'm not trying to be rude but, I don't see what else i can improve at this, besides the title. – Rolfsky Oct 21 '20 at 08:15
  • 1
    `fn:lower-case` is from XPath 2.0. You cannot use it in Selenium. Try workaround `//*[(contains(@title, 'rate') or contains(@title, 'RATE')) or (contains(., 'rate') or contains(., 'RATE'))]` – JaSON Oct 21 '20 at 09:02

1 Answers1

0

Since you are using XPath 2.0, you can use matches with regex

try //*[matches(@title, 'rate', 'i')]

for both title and inner text

//*[matches(@title, 'rate', 'i') or matches(., 'rate', 'i')]

kennysliding
  • 2,783
  • 1
  • 10
  • 31