cancel
Showing results for 
Search instead for 
Did you mean: 

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

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

New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors