I found this https://bitbucket.org/chromiumembedded/cef/wiki/UsingChromeDriver link which has java binding for cef client and Selenium Driver.
So I prepared one for me to use it with c# windows application. what i have done is created a new winapp project x86 that only contains the following code that runs with no error or issue:
using CefSharp;
using CefSharp.WinForms;
namespace ClientBrowser
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public ChromiumWebBrowser browser;
private void Form1_Load(object sender, EventArgs e)
{
var settings = new CefSettings();
settings.CefCommandLineArgs.Add("enable-npapi", "1");
settings.IgnoreCertificateErrors = true;
//settings.CefCommandLineArgs.Add("enable-system-flash", "1");
Cef.Initialize(settings);
browser = new ChromiumWebBrowser("");
this.Controls.Add(browser);
browser.Dock = DockStyle.Fill;
}
}
}
above project is to act as cef client for the below new winapp project x86 below:
private void Form1_Load(object sender, EventArgs e)
{
try {
var options = new ChromeOptions();
options.BinaryLocation = @"path/ClientBrowser.exe";
//options.AddArgument("--log-level=3");
var service = ChromeDriverService.CreateDefaultService();
//service.HideCommandPromptWindow = true;
driver = new ChromeDriver(service,options); //chromedriver.exe
driver.Navigate().GoToUrl("http://stackoverflow.com/");
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
now when I run the new above Project,
chromedriver.exe says:
Starting ChromeDriver 2.21.371459 (36d3d07f660ff2bc1bf28a75d1cdabed0983e7c4) on port 57883
Only local connections are allowed.
and then
ClientBrowser.exe opens up with nothing displayed in it and no error encountered but after 60 sec I am getting:
The HTTP request to the remote WebDriver server for URL http://localhost:57883/session timed out after 60 seconds.
but it should open http://stackoverflow.com/ for me, I don't know what I am doing wrong, I have not included any selenium-server-standalone-x.y.z.jar? do I need this, if yes please any one let me know how do I include it.
also tried running it with Administrator Privilege
is there any way to directly bind ChromeDriver with ChromiumWebBrowser , so there will be no need for cefclient.exe
also tried with RemoteWebDriver:
try {
var options = new ChromeOptions();
options.BinaryLocation = @"C:\pathto\ClientBrowser.exe";
options.AddArgument("--remote-debugging-port=1131");
options.AddArgument("url=data:,");
//options.AddArgument("--log-level=3");
var service = ChromeDriverService.CreateDefaultService();
//service.HideCommandPromptWindow = true;
service.Port = 1131;
service.Start();
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.SetCapability(ChromeOptions.Capability, options);
driver = new RemoteWebDriver(service.ServiceUrl, capabilities); //DesiredCapabilities.Chrome()
//driver = new ChromeDriver(service,options); //chromedriver.exe
driver.Navigate().GoToUrl("http://stackoverflow.com/");
}
but RemoteWebDriver also didn't work for me, really stuck now, please
any help or suggestion would be a great help for me and for others too who wanted to do the same like me, Thanks in advance.

