Welcome Guest Search | Active Topics | Sign In | Register

Automated testing tools to test browing apps Options
Christian Porzio
Posted: Tuesday, March 28, 2017 5:32:24 PM
Rank: Advanced Member
Groups: Member

Joined: 10/4/2016
Posts: 104
Hi,

We are using some automated tool framework such as http://www.seleniumhq.org/ but as much as those tools seems to be fully adapted to interface with common browsers in order to interact with the UI and inspect the result, they do no seem to suit for a web app running in the EO.Web engine.

Would you make any recommendation that would allow us testing our web app now running in the EO.Web wrapper?

Thank you for your input on the matter.

Regards
eo_support
Posted: Wednesday, March 29, 2017 3:48:30 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,082
Hi,

Selenium relies on Chrome's remote debug protocol to function. So there are two things need to work properly:

1. You must enable the remote debug by setting this property:

https://www.essentialobjects.com/doc/eo.webbrowser.runtime.remotedebugport.aspx

2. The remote debug server is implemented by EO.WebBrowser. The remote debug client in this case is implemented by ChromeDriver. You need to ensure they match in versions. Specifically, EO.WebBrowser is based on Chromium V54, so if you use the latest ChromeDriver, which works with Chromium V55 and above, you might run into compatibility issues. In this case please try an older version of ChromeDriver from here and see if it helps:

https://sites.google.com/a/chromium.org/chromedriver/downloads

Hope this helps. Please let us know if this resolves the issue for you.

Thanks!
Christian Porzio
Posted: Wednesday, March 29, 2017 3:53:10 PM
Rank: Advanced Member
Groups: Member

Joined: 10/4/2016
Posts: 104
Your answer looks very promising. Let try it and I let you know. Thank you so much!
Christian Porzio
Posted: Thursday, March 30, 2017 8:14:44 PM
Rank: Advanced Member
Groups: Member

Joined: 10/4/2016
Posts: 104
Hi,

Sorry to ask you that. I realize it does not relate directly to your framework, but not finding much resource on the web in that regards maybe you would have an insight.

So I have added an option to assign the debug port # when starting my EO.Web application as you indicated.

However when creating the ChromeDriver in my selenium framework:
(*)
Code: C#
System.setProperty("webdriver.chrome.driver", "MyEOWebApp.exe");
driver = new ChromeDriver();

(*) Actually Selenimium framework is Java based

Then MyEOWebApp.exe is starting however the ChromeDriverService is picking up a random port. So it is hard to assign a port# if I know its value only when the executable has started.

Bottom line, I was wondering if among your existing users, one of them has used Selenium and had already resolved this setup conflict.

The tool is taking more importance every day in the company, more and more teams are migrating away from Chrome native to this new EO.Web Desktop application. But these groups want to be able to use the scripts they have developed to test their web applications.

Thank you again for your assistance
eo_support
Posted: Monday, April 3, 2017 5:08:32 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,082
Hi,

We have looked into this issue and is able to get it to work. Below is our findings:

There are three different components and two different connections. The three components in a test setup are:

A. Your test code. This is your C# code that creates ChromeDriver class and calls various methods on that class;
B. ChromeDriver.exe. This is provided by Google. You can not replace this part with your own;
C. Your application that uses EO.WebBrowser. This is the application to be tested;

The sequences of events to initialize a test setup is:

1. A (your test code) starts process B (ChromeDriver.exe) through ChromeDriver class. You can specify the location/folder of B (issue X), but you can not replace it (this means you can not set "webdriver.chrome.driver" to your exe file. Your exe file is C, not B);
2. A establish a connection to B. This is the random port you mentioned. This has nothing to do with remote debug protocol;
3. B (ChromeDriver.exe) starts process C (your application to be tested). Here you must specify the full path of C (issue Y);
4. B establish a connection to C. This is the remote debug protocol connection. Here B and C must agree on port (issue Z);

This leaves issue X, Y and Z to be resolved.

To resolve issue X, you would pass the folder that contains ChromeDriver.exe to the constructor of your ChromeDriver class. For example, if ChromeDriver.exe is in "c:/Test" folder, then you would do:

Code: C#
//The first argument of the ChromeDriver constructor specifies the 
//location of ChromeDriver.exe
driver = new ChromeDriver("c:/Test");


To resolve issue Y, you would need to use ChromeOptions class:

Code: C#
//The BinaryLocation of the ChromeOptions class allows you to
//override the default path of chrome.exe. If you do not set this
//property, ChromeDriver would try to search for chrome.exe on
//your system and starts it. Set this property to your application
//path so that ChromeDriver would start your application instead
ChromeOptions options = new ChromeOptions();
options.BinaryLocation = "full_path_of_your_application";
m_Driver = new ChromeDriver("C:/Test", options);


When ChromeDriver.exe starts your application (which "pretends" to be chrome.exe), it passes numerous command line arguments to it. One of these command line arguments contains the remote debug port ChromeDriver.exe determined that your application should use. To resolve issue Z, you must pass this command argument straight to the browser engine. To achieve maximum compatibility, we recommend you to copy all arguments. The following code copies all command line arguments to the browser engine:

Code: C#
//Copy all command line arguments to sb. One of
//these command line argument is the remote debug
//port
StringBuilder sb = new StringBuilder();
string[] args = Environment.GetCommandLineArgs();
foreach (string arg in args)
{
    //All chrome command line arguments starts with "--",
    //so here we copy all command line arguments that
    //start with "--"
    if (arg.StartsWith("--"))
    {
        if (sb.Length > 0)
            sb.Append(" ");
        sb.Append(arg);
    }
}

//Pass it straight to the browser engine
EO.WebEngine.Engine.Default.Options.ExtraCommandLineArgs = sb.ToString();


If you test above code with our TabbedBrowser sample, you would put it along with other engine options inside App.xaml.cs before this line:

Code: C#
MainWindow mainWnd = new MainWindow();


Make sure you remove this line in the sample code:

Code: C#
EO.WebEngine.Engine.Default.Options.RemoteDebugPort = 1234;


Since you now must accept the port ChromeDriver.exe passed to you instead of having it hard coded.

EO.WebBrowser supports the majority part of the remote debug protocol but not all of them. For example, APIs to automate chrome's tab system are not there. However for basic automation it should work fine for you.

Hope this will get you started. Please feel free to let us know if you run into any more bumps.

Thanks!
Christian Porzio
Posted: Monday, April 3, 2017 5:19:42 PM
Rank: Advanced Member
Groups: Member

Joined: 10/4/2016
Posts: 104
Just reading your answer. It makes a lot sense now that I worked a little bit this test team.

Let me pass this info to them while I worked on the command line argument.

Thank you so much!!!
eo_support
Posted: Monday, April 3, 2017 5:24:48 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,082
You are very welcome. Feel free to let us know if there is anything else.
Christian Porzio
Posted: Monday, April 17, 2017 7:38:04 PM
Rank: Advanced Member
Groups: Member

Joined: 10/4/2016
Posts: 104
FYI... We were able to test our EO.Web application within Selenium using the exact same scripts as the ones meant for Chrome thanks to your directions.

Thank you very much, this will really help down the road.
eo_support
Posted: Tuesday, April 18, 2017 8:53:30 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,082
You are very welcome. Glad to hear it works for you!
New User
Posted: Friday, July 20, 2018 7:47:48 AM
Rank: Newbie
Groups: Member

Joined: 7/20/2018
Posts: 1
Hi,
I too have a desktop app that is built on EO.WebBrowser,
and the above use case exactly depicts my problem statement about automation using selenium and solution looked promising.
While trying it out, i am stuck on how can I inspect HTML elements of my EO based app, like i do on chrome browser(it is required to make test scripts) ?

Is there a way? kindly guide me. Thanks

eo_support
Posted: Friday, July 20, 2018 9:10:14 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,082
Hi,

I am not sure exactly what you meant by "required to make test script". You would normally inspect HTML element this way:

https://www.essentialobjects.com/doc/webbrowser/advanced/debug.aspx

If you need to inspect elements with code, then you just do it with JavaScript through WebView.EvalScript.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.