How to use css selector with “not” in c#?
I want to find elements by css selector, but I want to skip some of them, how can I do it?
but I need not to take href that has logoff and client/contract in it
You probably don't need LINQ for this. You can use the
:not() pseudo-class, one for each value you want to exclude (note the
*= in each negation; I'm assuming substring matches here):
An exception is if you have a dynamic list of values that you want to exclude: you can either build your selector programmatically using
string.Join() or a loop and then pass it to
By.CssSelector(), or you can follow Richard Schneider's answer using LINQ to keep things clean.