Test with Chrome 112.0.5615.137 and uBlock Origin 1.49.2
www.google.com##div:has-text("It looks like there aren't many great matches for your search")
www.google.com##div:has-text(/It looks like there aren\'t many great matches for your search/)
Possibly because it narrows down the number of divs to consider.
www.google.com##div[role="heading"]:has-text("It looks like there aren't many great matches for your search")
Escape the apostrophe/quote/quotation mark and add markers for beginning ^
and end $
of text.
www.google.com##div:has-text(/^It looks like there aren\'t many great matches for your search$/)
www.google.com##div:xpath(//div[contains(text(), "It looks like there aren't many great matches for your search")])
Fairly verbose, but not affected by changes of class or id names. The upward
operator is more concise alternative to using the xpath
operator with the ancestor
axis (e.g. xpath(ancestor::div[data-async-context])
).
www.google.com##div:has-text(/^It looks like there aren\'t many great matches for your search$/):upward(div[data-async-context]) > div:nth-child(1)
Very simple, but possibly less robust.
www.google.com##div#rso > div:nth-child(1)