I want to use this CSS selector with Selenium webdriver
#coordinatonTable .odd:not(:has(.dataTables_empty))
I get an "An invalid or illegal string was specified" error. I tried the jquery selector test from w3schools. Also this service show me "illegal selector". If I shorten the selector it works
#short .odd:not(:has(.dataTables_empty))
#coordinatonTable .odd:not(:has(.short))
#short .odd:not(:has(.short))
Looks like the selector is to long. But this can not really be true. Any suggest?
The structure of the html part is like this:
id="coordinatonTable"
class="odd"
class="dataTables_empty"
class="odd"
class="something"
class="odd"
class="somethingelse"
...
I want get all odd element if they has no empty child.
:has is not a valid CSS selector. It is a jQuery extension and will be invalid in any CSS file.
I have no idea why your other examples didn't cause an error. They do for me.
:has is a jQuery selector - it's not part of the CSS3 spec. If you're just checking for the non-presence of a class, do:
#coordinatonTable .odd:not(.dataTables_empty)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With