C# Selenium Web Driver and CSS : Start point

C# Selenium Web Driver and CSS : Start point  #angularjs #reactjs

  • “first find parent tag, then I use parent as a start point to find parent tag itself”
  • But when I use logically wrong locator(“parent nested”, because together “parent parent nested” is wrong locator), parent.
  • Css(“parent nested”) or can move through make parent as start point and then move to child like var child= driver.
  • Css(“par‌ ent nested”) find the sub-child as “nested” of parent tag so no matter either you can find that sub-child either By.
  • Parent will be checked whether it is a child of the given element (calling on parent).

Notice, I need to find nested element only this way: at first I find parent tag, then I use parent as a start point to find nested one.
But when I use logically wrong locator(“parent nested”, because together “parent parent nested” is wrong locator), parent.FindElement returns(!) me correct IWebElement, just like if I searched from the top of DOM model.

@ng_real_ninja: C# Selenium Web Driver and CSS : Start point #angularjs #reactjs

I have the next tags structure:

I do the following thing:

Notice, I need to find nested element only this way: at first I find parent tag, then I use parent as a start point to find nested one. But when I use logically wrong locator(“parent nested”, because together “parent parent nested” is wrong locator), parent.FindElement returns(!) me correct IWebElement, just like if I searched from the top of DOM model.

The interesting thing is that when I do

it throws element not found exception.

I think I understand something wrong or just don’t know something. How does it work? How I can avoid problem of “parent parent nested” ?

C# Selenium Web Driver and CSS : Start point