private static ICommandExecutor CreateExtensionConnection(FirefoxBinary binary, FirefoxProfile profile, TimeSpan commandTimeout)
        {
            FirefoxProfile profileToUse = profile;

            string suggestedProfile = Environment.GetEnvironmentVariable("webdriver.firefox.profile");

            if (profileToUse == null && suggestedProfile != null)
            {
                profileToUse = new FirefoxProfileManager().GetProfile(suggestedProfile);
            }
            else if (profileToUse == null)
            {
                profileToUse = new FirefoxProfile();
            }

            FirefoxDriverCommandExecutor executor = new FirefoxDriverCommandExecutor(binary, profileToUse, "localhost", commandTimeout);

            return(executor);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="FirefoxDriverServer"/> class.
        /// </summary>
        /// <param name="binary">The <see cref="FirefoxBinary"/> on which to make the connection.</param>
        /// <param name="profile">The <see cref="FirefoxProfile"/> creating the connection.</param>
        /// <param name="host">The name of the host on which to connect to the Firefox extension (usually "localhost").</param>
        public FirefoxDriverServer(FirefoxBinary binary, FirefoxProfile profile, string host)
        {
            this.host = host;
            if (profile == null)
            {
                this.profile = new FirefoxProfile();
            }
            else
            {
                this.profile = profile;
            }

            if (binary == null)
            {
                this.process = new FirefoxBinary();
            }
            else
            {
                this.process = binary;
            }
        }
 private FirefoxDriver(FirefoxBinary binary, FirefoxProfile profile, ICapabilities capabilities, TimeSpan commandTimeout)
     : base(CreateExtensionConnection(binary, profile, commandTimeout), RemoveUnneededCapabilities(capabilities))
 {
     this.binary  = binary;
     this.profile = profile;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="FirefoxDriver"/> class for a given profile, binary environment, and timeout value.
 /// </summary>
 /// <param name="binary">A <see cref="FirefoxBinary"/> object representing the operating system
 /// environmental settings used when running Firefox.</param>
 /// <param name="profile">A <see cref="FirefoxProfile"/> object representing the profile settings
 /// to be used in starting Firefox.</param>
 /// <param name="commandTimeout">The maximum amount of time to wait for each command.</param>
 public FirefoxDriver(FirefoxBinary binary, FirefoxProfile profile, TimeSpan commandTimeout)
     : this(binary, profile, DesiredCapabilities.Firefox(), commandTimeout)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="FirefoxDriver"/> class for a given profile and binary environment.
 /// </summary>
 /// <param name="binary">A <see cref="FirefoxBinary"/> object representing the operating system
 /// environmental settings used when running Firefox.</param>
 /// <param name="profile">A <see cref="FirefoxProfile"/> object representing the profile settings
 /// to be used in starting Firefox.</param>
 public FirefoxDriver(FirefoxBinary binary, FirefoxProfile profile)
     : this(binary, profile, RemoteWebDriver.DefaultCommandTimeout)
 {
 }
Esempio n. 6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FirefoxDriverCommandExecutor"/> class.
 /// </summary>
 /// <param name="binary">The <see cref="FirefoxBinary"/> on which to make the connection.</param>
 /// <param name="profile">The <see cref="FirefoxProfile"/> creating the connection.</param>
 /// <param name="host">The name of the host on which to connect to the Firefox extension (usually "localhost").</param>
 /// <param name="commandTimeout">The maximum amount of time to wait for each command.</param>
 public FirefoxDriverCommandExecutor(FirefoxBinary binary, FirefoxProfile profile, string host, TimeSpan commandTimeout)
 {
     this.server         = new FirefoxDriverServer(binary, profile, host);
     this.commandTimeout = commandTimeout;
 }