Provides a mechanism to find the Chrome Binary
        /// <summary>
        /// Starts the connection to the browser extension.
        /// </summary>
        public void Start()
        {
            int retries = MaxStartRetries;

            while (retries > 0 && !HasClient)
            {
                Stop();
                try
                {
                    StartListening();
                    executorBinary.Start();
                }
                catch (IOException e)
                {
                    throw new WebDriverException("Could not start client", e);
                }

                if (!HasClient)
                {
                    // In case this attempt fails, we increment how long we wait before sending a command
                    ChromeBinary.IncrementStartWaitInterval(1);
                }

                retries--;
            }

            // The last one attempt succeeded, so we reduce back to that time
            // chromeBinary.IncrementBackoffBy(-1);
            if (!HasClient)
            {
                Stop();
                throw new FatalChromeException("Cannot create chrome driver");
            }
        }
Example #2
0
 /// <summary>
 /// Initializes a new instance of the ChromeDriver class with the required Chrome Binary
 /// </summary>
 /// <param name="chromeBinary">A <see cref="ChromeBinary"/> object to launch.</param>
 public ChromeDriver(ChromeBinary chromeBinary)
     : base(new ChromeCommandExecutor(chromeBinary), DesiredCapabilities.Chrome())
 {
 }
Example #3
0
 /// <summary>
 /// Initializes a new instance of the ChromeCommandExecutor class
 /// </summary>
 /// <param name="binary">The <see cref="ChromeBinary"/> in which the commands are executed.</param>
 internal ChromeCommandExecutor(ChromeBinary binary)
 {
     executorBinary = binary;
     InitializeCommandNameMap();
 }
 /// <summary>
 /// Initializes a new instance of the ChromeCommandExecutor class
 /// </summary>
 /// <param name="binary">The <see cref="ChromeBinary"/> in which the commands are executed.</param>
 internal ChromeCommandExecutor(ChromeBinary binary)
 {
     executorBinary = binary;
     InitializeCommandNameMap();
 }
Example #5
0
 /// <summary>
 /// Initializes a new instance of the ChromeDriver class with the required Chrome Binary
 /// </summary>
 /// <param name="chromeBinary">A <see cref="ChromeBinary"/> object to launch.</param>
 public ChromeDriver(ChromeBinary chromeBinary)
     : base(new ChromeCommandExecutor(chromeBinary), DesiredCapabilities.Chrome())
 {
 }
Example #6
0
 /// <summary>
 /// Initializes a new instance of the ChromeDriver class using the specified profile and extension.
 /// </summary>
 /// <param name="profile">The profile to use.</param>
 /// <param name="extension">The extension to use.</param>
 private ChromeDriver(ChromeProfile profile, ChromeExtension extension)
 {
     chromeBinary = new ChromeBinary(profile, extension);
     executor = new ChromeCommandExecutor();
     StartClient();
 }