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!