I'm new in QA.
I'm using VisualStudio 2017 + Selenium WebDriver.
I'm Trying driver.FindElementById
in Sharepoint 2010 web page.
It is part of the DOM:
<div id="ctl00_MSO_ContentDiv">
<a name="mainContent"></a>
<div style="padding: 20px">
<h2>
<span id="ctl00_PlaceHolderMain_LabelCourseTitle">***</span>
</h2>
<h3>
<span id="ctl00_PlaceHolderMain_LabelClassTitle">***</span>
</h3>
<div id="ctl00_PlaceHolderMain_PanelResult">
<h3>
<span id="ctl00_PlaceHolderMain_LabelStatus">***</span>
</h3>
</div>
</div>
I'm try two times:
1 - it is working!
Thread.Sleep(5000);
driver.FindElementById("ctl00_MSO_ContentDiv");
2 - Error: OpenQA.Selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"id","selector":"ctl00_PlaceHolderMain_LabelCourseTitle"}
Thread.Sleep(5000);
driver.FindElementById("ctl00_PlaceHolderMain_LabelCourseTitle");
I don't understand, why selenium can't find child elements. All parents of "ctl00_MSO_ContentDiv" can be found. All childs can't be found. Please help.
Update: I can stil find
<a name="mainContent"></a>
. But every thing bellow I can't find by selenium. Update: Chrome dev tools search elements by XPath normally.