Forum Discussion

bdrummond's avatar
bdrummond
Contributor
8 years ago

Help With Finding Objects/Controls Within a single (Dynamic) Page embedded Browser.

Hi All,

 

I have difficulties trying to find controls/objects within a single (dynamic) page embedded browser - within a a desktop application. So far, the furthest i can manage is to achieve is to find this sole single (dynamic) page within an application.

 

Could anyone guide me or give me some tips and example on how to do this? With this in mind, I am a software tester and not a software developer, although I have written my own test using JavaScript/Jscript in Test Complete...I don't have an advance knowledge of coding. Below are the Specs/Screenshots/Code Snippets and so far what i have tried to achieve to answer my own question

 

  • The browser in question is called a toolbox in our App, and is written using HTML5 & JavaScript and uses Chromium Embedded Framework to allow this web technologies to be used in a WinForms application (one said; "...is like a Chrome browser without the menus") See the top image.
  • I have made sure that the following are met when working with Test Complete 12.20.935:  
    • Exposing CEF-Based Application (using libcef.dll library & application executable are located in the same folder).
    • Window Off-Screen Rendering is disabled.
    • Verify CEF Support. See 2nd Image
  • I have uses the Page (Window Objects) Method to find the URL of the browser (the toolbox in the App) and make sure that it is exist. I also tried different methods to find controls in the browser but to no avail. 

    The toolbox is built using Angular and the idea with Angular is that its a single page web app and in our case the URL is always index.html - and then the contents of that page change dynamically.

function Test()
{
   var ic = Sys.Process("IC").WinFormsObject("MDIForm1").WinFormsObject("MdiClient", "")
   .WinFormsObject("ChartForm").WinFormsObject("dockSite2")
   .WinFormsObject("barChartToolbox").WinFormsObject("ChromiumWebBrowser", "")
   .Window("CefBrowserWindow", "", 1).Window("Chrome_WidgetWin_0", "", 1);
   
   var page = ic.Page("charttoolbox://index.html/");
   
   if(page.Exists)
   {
      Log.Message(":) Yay");
   }
   else
   {
      Log.Error(":( Nay" );
   }
   
   //var pageObj = page.FindAllChildren(page, "", 1)
   //var pageObj = page.ChildCount;
   //var allChildern = page.FindAllChildren("charttoolbox://index.html/", "", 1);
}

 

  • I have tried to use 'Record Script' but it doesn't help as it uses X/Y Coord with Click() Method.. See 3rd image.

 

I think that's all the info I can give out. Everyone's inputs and suggestions are much appreciated and thanks in advance for reading this 'dead-end' issue to-date : (

 

BD

 

 

  • bdrummond's avatar
    bdrummond
    8 years ago

    Hi tristaanogre,

     

    Thanks a lot for your input. I have spoken to the developer & Project Manager regarding your idea of prototyping.

     

    I may get this later on (probably, next month) as things getting busy in here.

     

    I will update this article once I have them. In the meanwhile the TCs support still helping me with an alternative.

     

    thanks alot.

     

    BD

  • Hi all again,

     

    After a few weeks of exchanging emails to/from Test Complete support. They have given me a solution to the issue which I originally have encountered.

     

    Now, I can see the objects under the main page and view it in Object Explorer (see images). The support ask me to insert the following Command-line parameters in the "TestedApps":

     

    -injectcefhook --register-pepper-plugins="c:\Program Files (x86)\SmartBear\TestComplete 12\x64\Bin\Extensions\tcCrExtension\tcCEFHost.dll;application/x-testcomplete12-0-chrome-browser-agent"

    I am not sure whether this would only worked on my machine's environment or this can be used generically across all different users which has come across this problem.

     

    Although it is still too early to tell how good this solution is, as I haven't gone and test this too far just yet, this is a big milestone to our testing and glad to have it working.

     

    Thank you for all of your inputs!

     

    Regards,

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    While the application is a desktop application, the fact that it is an embedded browser means you still need to have the web module of TestComplete to work with the individual objects and components within the embedded pages. I have a similar application that I'm testing and, without the web module, we cannot see the components within the embedded IE browser objects.  With the web module enabled, suddenly, everything is there. :)

    • bdrummond's avatar
      bdrummond
      Contributor

      Hi Tristaanogre,

       

      Thanks for you input. To clarify what you've said regarding to "..have the web module of TestComplete to work with ind..." do you mean the TestComplete Extensions?

       

      I have enabled the necessary extensions to work with embedded web page in as application. see image below. image attached below.

       

      do you have any example with what you have done?

       

      regards,

       

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        Not exactly the extensions... more on the lines of the actual license to use TestComplete to test web applications.  I think the extensions are installed regardless of whether or not you have the license.  It's possible you have the web license but that's one of the first things I'd check.

         

        Since it's a Chromium Embedded Browser, there ARE a few conditions in order to allow TC to see those kinds of objects.  Please read https://support.smartbear.com/testcomplete/docs/app-testing/web/general/cef-support.html