I have a problem with some css selector (I have only one way to find an element if I use JS commands so only CSS selector is available for me) The page looks like this:
<div class='test'>
some_text
<span> some_other_text </span>
</div>
And I need to get some_text without getting "some_other_text";
I tried to use:
By.CssSelector("div[class='test'] :not(span)")
>> it returns all text;
By.CssSelector("div[class='test'] span:not(last-child)")
>> it returns only "some_other_text";
By.CssSelector("div[class='test'] span:not(:last-child)")
>> it returns only "some_other_text";
By.CssSelector("div[class='test']:not(:last-child)")
>> it returns only "some_other_text";
is there any way to do what I need? could anyone help me , please?