I am doing an automation script for a work project and I need to be as precise as possible with elements on the page and their positions. Bellow is part of the html of the page with an example of an issue I am facing.
<div _ngcontent-umj-c296="" class="ui inverted menu" style="border-bottom: 1px #444 solid; margin-bottom: 0;" xpath="1">
<button _ngcontent-umj-c296="" type="button" id="logo" class="header item icheader" xpath="1">
I am trying to assert the button is inside the "inverted menu". It is crucial for my automation to make sure the button is not only displayed on the page, but also inside the menu. This is not the only element on that menu. It is also just a clickable button (action to take the user to the home page).
I have already defined the menu as:
IWebElement topFrame = driver.FindElement(By.CssSelector("div[class='ui inverted menu']"));
I also have an assert to confirm the menu is present on the page:
Assert.IsTrue(topMenu.Displayed, "Top menu bar is not displayed");
Is this possible? Or is it only possible to see if the element is displayed on the page?