Ask a Question

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

SOLVED
bdrummond
Contributor

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

 

 

20 REPLIES 20
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. 🙂


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

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
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


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

I noticed that you mentioned you already went through some of the preparation for doing CEF support.  Do you know what version of CEF your application is developed with? 

 

Also, according to that document, you need to make sure that your application is launched via the TestApplications part of TestComplete.  Manually launching it I'm not 100% certain will do what you need it to do.  Can you confirm (see bold section below):


In order to expose a CEF-based application, you need to add it to the Tested Applications collection and then launch it in Simple run mode, while one of the following conditions is met:

  • The application's executable imports the libcef.dll library.

-- or --

  • The libcef.dll library and the application's executable are located in the same folder.

-- or --

  • The application has the injectCefHook command-line argument (in any letter case and with any prefix).

Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

Hey,

 

At the moment I couldn't answer whether I have a web license for test complete just yet, but i have already asked TC support group for the answer. I am pretty sure it has one....but i cant say with 100% confidence.

 

But, I can confirm that i did run the tested App via the TestApplications part of TestComplete. I never run the App to be tested manually (well maybe now and then, but hardly...). I already make sure to use the "injectCefHook" as command line parameter on the tested App too. see image below.

 

TC's support has mentioned of finding the Page object and hit "*" keystroke to expand it (i'd take it he/she meant clicking * in the keyboard whilst the Page object is selected...right?!) but this still to no avail : (

 

 

 

tristaanogre
Esteemed Contributor

Do you know version of the Chromium framework you're using? The documentation indicates that there is a particular version of CEF3 supported... any versions EARLIER than that are supported as well... but any versions LATER than that are not.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

ahhh..whoops. Sorry I forgot to answer the Cef Ver. question.

 

The version we're using is CefSharp version 51 - ah snap, if that's the case, I will need to get through TC support to push some enhancement request then.

 

I withdrew my statement above....I have spoken to the developer...

 

"...CefSharp is the library that we use because we are in C#.......its CefSharp that uses CEF.....so the internal version of CEF is likely version 3. I believe CEF itself only goes up to version 3."

 

I will get back to you if the developer support have any a definite answer to this. Thanks a lot for you time tristaanogre.

 

Regards,

 

BD

tristaanogre
Esteemed Contributor

Yup, right there is your problem.  CEFSharp 51 has the follow:

 

July 15, 2016, Chromium 51.0 / CEF 3.2704.1432(Chromium 51.0.2704.103)

 

The supported version of CEF 3 in TC 12.30 is 3.2623.1395 so you're a little bit beyond the supported version.  Right there might be your problem.

 

Yup, certainly work with support  and see about getting a reqest through to enhance their support.  I see CEF Sharp is up to 57 now with CEF3 3.2987.1601 so their running a bit behind there.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
tristaanogre
Esteemed Contributor


@bdrummond wrote:

ahhh..whoops. Sorry I forgot to answer the Cef Ver. question.

 

The version we're using is CefSharp version 51 - ah snap, if that's the case, I will need to get through TC support to push some enhancement request then.

 

I withdrew my statement above....I have spoken to the developer...

 

"...CefSharp is the library that we use because we are in C#.......its CefSharp that uses CEF.....so the internal version of CEF is likely version 3. I believe CEF itself only goes up to version 3."

 

I will get back to you if the developer support have any a definite answer to this. Thanks a lot for you time tristaanogre.

 

Regards,

 

BD


Gotcha.  Right... CefSharp is the .NET library... however, based upon what I found at https://github.com/cefsharp/CefSharp/releases each version of CEFSharp has, internally, a different version of CEF3.  So, if they are using CefSharp 51, then it's most likely that they are using a later version of CEF than what is supported.  Would be interesting to know what you find out so, please post any responses you might get.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
cancel
Showing results for 
Search instead for 
Did you mean: