Forum Discussion

Gunacelan's avatar
Gunacelan
Contributor
4 years ago

FindChildByXpath throws error in testcomplete

 
Sys.Browser("chrome").Page("*").FindChildByXPath("//button[normalize-space(text())= 'Advanced']");
 
throws me unidentified javascript runtime error at FindChildByXPath
 
 
Note:Use Xpath and Css selectors checkbox is also selected
 
 
What seems to be the issue here?
  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    Hi,

     

    Use Xpath and Css selectors checkbox is also selected

    If you are talking about 'Use XPath and CSS selectors for web objects' project properties option, then .FindElement() method must be used instead of .FindChildByXPath().

     

    • Gunacelan's avatar
      Gunacelan
      Contributor

      FindElement also doesn't work. Not sure what is the reason

    • Gunacelan's avatar
      Gunacelan
      Contributor

      And what if I uncheck the 'Use Xpath and css selectors' property , will FindChildByXpath work?

      • AlexKaras's avatar
        AlexKaras
        Champion Level 3

        Hi,

         

        FindElement also doesn't work. Not sure what is the reason

        Can you post a screenshot of the code and log?

         

        if I uncheck the 'Use Xpath and css selectors' property , will FindChildByXpath work?

        Yes, it should, but this will disable cross-platform mode and switch back to default local one. (So you will not be able to execute your tests in CrossBrowserTesting and other cloud environments.)

         

        > Sys.Browser("chrome").Page(...).FindChildByXPath(...);

        Another possible reason is that page was not navigated to.