I have CSS selector and was trying to apply it in selenium.
Css selector is .parentclass:not(:has(.childclass))
. I am trying to get all parent elements which do not have descendent element with class childclass
. It works perfect in jQuery. But in selenium seems it doesn't work.
So I decided to try XPath. What is the equivalent in XPath to the aforementioned CSS selector? I was able to get worked the following:
//*[contains(@class, 'parentclass')]
. But this is only first part of the condition. How can I say in XPath that I need only parents which don't contain children with CSS class childclass?