Search code examples
c#seleniumranorex

Ranorex can not start Chrome browser, no warning or error


  • Ranorex 7.0.1, evaluation version, 28 days left
  • OS, Windows 10
  • Chrome driver, 2.29
  • Selenium webdriver standalone server, 3.4.0

I have set up Endpoint as Local Selenium WebDriver, its connection has been tested as "Connected".

WebDriver, WebDriver.Support have been added to References.

The code snippet is shown below:

namespace HoT
{
    class Program
    {
        [STAThread]
        public static int Main(string[] args)
        {
            // Uncomment the following 2 lines if you want to automate Windows apps
            // by starting the test executable directly
            //if (Util.IsRestartRequiredForWinAppAccess)
            //    return Util.RestartWithUiAccess();

            Keyboard.AbortKey = System.Windows.Forms.Keys.Pause;
            int error = 0;
            var webDriver = new ChromeDriver(@"C:\Users\myName\Documents\Ranorex\RanorexStudio Projects\HoT\HoT\ExternalModules\chromedriver");
            webDriver.Navigate().GoToUrl("http://www.google.com");

            try
            {
                error = TestSuiteRunner.Run(typeof(Program), Environment.CommandLine);
            }
            catch (Exception e)
            {
                Report.Error("Unexpected exception occurred: " + e.ToString());
                error = -1;
            }
            return error;
        }
    }
}

All I got is a console window and a pop up window, there is no Chrome browser instance or warning or error. Anyone knows why?

enter image description here


Solution

  • You need to start the browser with

    Host.Current.OpenBrowser("http://www.google.com", "Chrome", "", false, false, false, false, false);