Forum Discussion

tvklovesu's avatar
tvklovesu
Frequent Contributor
2 years ago

Object not found when using FindElement(xpath) with a Parent object

Hello, I am seeing this issue for a long time but never thought of fixing it as I used some other solutions. So, when I try to use Findelement with a parent object and use xpath then the object unde...
  • AlexKaras's avatar
    2 years ago

    Hi,

     

    I am not a fan of XPath in TestComplete world and thus don't remember exact syntax, but of top of my head:

    -- Double slash at the start of XPath effectively commands XPath engine to search from the top of the page;

    -- XPath must start with dot and slash to command XPath engine to search from the current element (i.e. something like that, if I am not mistaken: ./label[contains(.,'Highlight quantity discrepancies')]");

    -- If my above two statements are correct, than this your syntax looks to be correct:

    Aliases.browser.RavenDarttsPge.Highlight_Quantity_section.findElement("./following-sibling::div//div[@aria-label='greater or less than']")

     

    P.S. Hope, my statements are correct as per this: https://learn.microsoft.com/en-us/previous-versions/dotnet/netframework-4.0/ms256086(v=vs.100)