Ask a Question

Unable access iframe objects using findchildbyxpath

New Contributor

Unable access iframe objects using findchildbyxpath

I'm find the page objects using findchildbyxpath but iframe objects are returning null even path is fine in UI

Champion Level 3

What happens when you use Object Spy on one of those objects?  Please give us a screenshot of the results.

Sorry for the delay response Object spy cant access the particular object because that object belongs to map. 

please find the screen shot attachment for your referance 

mapFrame = gapPage.FindChildByXPath("//iframe[contains(@src,'flows')]")

above code returning the object 

isMapLoaded = gapPage.FindChildByXPath("//div[contains(@id,'map-loader')]")

the above one returning none type even the xpath is accessing the UI level

Try the Object Spy within TestComplete please.

SmartBear Alumni (Retired)

Thanks Marsha_R for being helpful! 


Hi @sasiarun1127 , it looks like what you are experiencing could be Chrome-specific. Are you using this browser? Chrome can be stopping TestComplete from looking at the iFrame objects. Here’s a quote from a support case with an issue similar to yours: 



Please try using the following command line arguments to run chrome: chrome.exe --disable-web-security --user-data-dir=c:\users\user\tempChromeProfile\ --disable-site-isolation-trials If you don't have this folder (c:\users\user\tempChromeProfile\), it will be created automatically. Please note that you will need to enable our extension (SmartBear Test Extension) for the new profile. Information on these arguments can be found in the link below:



Please also read the following article for more information: 


Let me know if this approach helps. Thank you. 

Sonya Mihaljova
Community and Education Specialist



You should (even must) avoid using .FindChildByXPath() in favor of native .FindXXX() methods provided by TestComplete.

.FindChildByXPath() is the last resort way when nothing else works.


  /Alex [Community Champion]
[Community Champions] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Champions]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Champion] signature is assigned on quarterly basis and is used with permission by SmartBear Software.

Thanks for the response i will check it and let you. 

SmartBear Alumni (Retired)

Hi @sasiarun1127 , were you able to figure out a solution? Did any of the suggestions help? 

Sonya Mihaljova
Community and Education Specialist

thank you so much for your support
I checked with different iframe element using findchildbyxpath everything is working fine i am able to locate the element using find child or fildchildbyxpath actual problem is unable to access google map elements only.
we found the solution
took the iframe src and open it separate window now i am able to access the object elements using object spy and findchild

Showing results for 
Search instead for 
Did you mean: