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">
        <span id="ctl00_PlaceHolderMain_LabelCourseTitle">***</span>
        <span id="ctl00_PlaceHolderMain_LabelClassTitle">***</span>
    <div id="ctl00_PlaceHolderMain_PanelResult">
            <span id="ctl00_PlaceHolderMain_LabelStatus">***</span>

I'm try two times:

1 - it is working!


2 - Error: OpenQA.Selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"id","selector":"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.

closed as unclear what you're asking by Niels van Reijmersdal, IAmMilinPatel, Bharat Mane, c32hedge, trashpanda Apr 23 at 8:34

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • Can you check css that is applied to your element that cannot be found? – Alexey R. Jul 3 '18 at 9:17
  • @AlexeyR. looks like nothing criminal. font-size, font-weight, font-family, color, it is all. – Daniel N. Jul 3 '18 at 9:44
  • Can you find the elements in dev tools? – Mate Mrše Jul 5 '18 at 9:21
  • @MateMrše yes, by //*[@id="ctl00_PlaceHolderMain_LabelStatus"] or contains(text()... – Daniel N. Jul 5 '18 at 12:57
  • Is the element in the page but not visible initially perhaps until you click on that area – Michael Durrant Aug 4 '18 at 16:13

Try this below xpath for locating the child element


This xpath will search for the child elements.

  • //h2/following::span[@id="ctl00_PlaceHolderMain_LabelCourseTitle"] - I try this in xpath validator with my DOM - doesn't work. And I think it will not wok becouse I try in selenium find just "h3" driver.FindElementByXPath("//h3"); and it is faild ( – Daniel N. Jul 3 '18 at 13:43
  • if you want to find just h3 then find by using tagname driver.findElement(By.tagName("h3")); This will work – Prasanna venkatesh Jul 3 '18 at 13:51
  • The problem is that I can not get any of the items below <div id="ctl00_MSO_ContentDiv"> in my Sharepoint. In any way. driver.FindElementByTagName("h3"); doesn't work. – Daniel N. Jul 3 '18 at 13:58
  • Is there any texts present in span tag? – Prasanna venkatesh Jul 3 '18 at 14:04
  • Yes, i replace it by *** – Daniel N. Jul 3 '18 at 14:11

Try with the below xpaths:



  • ( Unable to locate element. With chrome devtools this xpath works fine. – Daniel N. Jul 5 '18 at 13:05

Not the answer you're looking for? Browse other questions tagged or ask your own question.