Ask a Question

JavaScript Custom function for finding objects within the iframe

SOLVED
K_Sathish_Kumar
Contributor

JavaScript Custom function for finding objects within the iframe

Hi Team, 

 

i am trying to find element objects within an ifram object, but im not able to do a object spy on those, so i had tried launching the browser by disabling the web securites and noticed that the time taken to find objects after i disable web securites is too long, hence trying to write a javascript code which will be working similar to javascript executor in selenium, as so this will be used to find elements using xpath for even objects within the iframe object.

 

please help me how to implement the same in testcomplete,

waiting for valuable replies, thanks in advance.

 

Thanks and Regards,

Sathish Kumar K

Regards,
Sathish Kumar K
1 ACCEPTED SOLUTION

Accepted Solutions
K_Sathish_Kumar
Contributor

Re: JavaScript Custom function for finding objects within the iframe

i found the solution by launching the chrome using Command-line arguments 

and find the iframe object as a parent and after that try finding all the required child objects using parent.findchild() or parent.FindElement() methods.

below is the sample code to launch the chrome using Command-line arguments:

def launchBrowser():
  if Sys.WaitBrowser("chrome").Exists:
    #code to close the browser
    closeBrowser()
  strChromeProfilePath = aqEnvironment.GetEnvironmentVariable("USERPROFILE") + '\\Documents\\TempChromeProfile\\'
  Browsers.Item["chrome"].RunOptions = '--disable-web-security --user-data-dir='+strChromeProfilePath+' --disable-site-isolation-trials'
  Browsers.Item["chrome"].Run
  Browsers.Item["chrome"].Navigate('https://www.abcdefg.com');
  Sys.Browser("chrome").BrowserWindow(0).Maximize()
  page = Sys.Browser("chrome").Page('https://www.abcdefg.com')
  page.Wait()

 

Thanks and Regards,

Sathish Kumar K

 

Regards,
Sathish Kumar K

View solution in original post

3 REPLIES 3
Marsha_R
Community Hero

Re: JavaScript Custom function for finding objects within the iframe

The references here may be of some help with finding your objects:https://community.smartbear.com/t5/TestComplete-Functional-Web/Unable-to-identify-objects-within-Ifr...


Marsha_R
[Community Hero]
____
[Community Heroes] 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 Heroes]
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 Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
K_Sathish_Kumar
Contributor

Re: JavaScript Custom function for finding objects within the iframe

My requirement Is also the same situation were im also looking to find objects within the Iframe object,

but nothing helped me in the same article, so just wanted to know how to achieve the same.

please let me know the alternative method for "switchToFrame();", so that this would help me a lot.

 

Thank you

Regards,
Sathish Kumar K
K_Sathish_Kumar
Contributor

Re: JavaScript Custom function for finding objects within the iframe

i found the solution by launching the chrome using Command-line arguments 

and find the iframe object as a parent and after that try finding all the required child objects using parent.findchild() or parent.FindElement() methods.

below is the sample code to launch the chrome using Command-line arguments:

def launchBrowser():
  if Sys.WaitBrowser("chrome").Exists:
    #code to close the browser
    closeBrowser()
  strChromeProfilePath = aqEnvironment.GetEnvironmentVariable("USERPROFILE") + '\\Documents\\TempChromeProfile\\'
  Browsers.Item["chrome"].RunOptions = '--disable-web-security --user-data-dir='+strChromeProfilePath+' --disable-site-isolation-trials'
  Browsers.Item["chrome"].Run
  Browsers.Item["chrome"].Navigate('https://www.abcdefg.com');
  Sys.Browser("chrome").BrowserWindow(0).Maximize()
  page = Sys.Browser("chrome").Page('https://www.abcdefg.com')
  page.Wait()

 

Thanks and Regards,

Sathish Kumar K

 

Regards,
Sathish Kumar K

View solution in original post

cancel
Showing results for 
Search instead for 
Did you mean: