private static ICommandExecutor CreateCommandExecutor(FirefoxBinary binary, FirefoxProfile profile, int port) { profile.SetPreference("marionette.defaultPrefs.enabled", true); profile.SetPreference("marionette.defaultPrefs.port", port); profile.SetPreference("browser.warnOnQuit", false); return(new MarionetteCommandExecutor(binary, profile)); }
/// <summary> /// Starts the specified browser. /// </summary> /// <param name="browser">The browser.</param> /// <exception cref="System.NotSupportedException">When driver not supported</exception> public void Start(string browser) { switch (browser) { case "Firefox": Handle = new FirefoxDriver(this.FirefoxProfile); break; case "FirefoxPortable": var profile = this.FirefoxProfile; var firefoxBinary = new FirefoxBinary(BaseConfiguration.FirefoxPath); Handle = new FirefoxDriver(firefoxBinary, profile); break; case "InternetExplorer": var options = new InternetExplorerOptions { EnsureCleanSession = true, }; Handle = new InternetExplorerDriver(@"Drivers\", options); break; case "Chrome": Handle = new ChromeDriver(@"Drivers\"); break; default: throw new NotSupportedException( string.Format(CultureInfo.CurrentCulture, "Driver {0} is not supported", browser)); } Handle.Manage().Window.Maximize(); }
private static ICommandExecutor CreateCommandExecutor(FirefoxBinary binary, FirefoxProfile profile, int port) { profile.SetPreference("marionette.defaultPrefs.enabled", true); profile.SetPreference("marionette.defaultPrefs.port", port); profile.SetPreference("browser.warnOnQuit", false); return new MarionetteCommandExecutor(binary, profile); }
private void CopeWithTheStrangenessOfTheMac() { if (Platform.CurrentPlatform.IsPlatformType(PlatformType.Mac)) { try { Thread.Sleep(300); if (this.process.ExitCode == 0) { return; } Thread.Sleep(10000); this.StartFirefoxProcess(); } catch (ThreadStateException) { } try { FirefoxBinary.Sleep(300); if (this.process.ExitCode != 0) { StringBuilder stringBuilder = new StringBuilder("Unable to start firefox cleanly.\n"); stringBuilder.Append("Exit value: ").Append(this.process.ExitCode.ToString(CultureInfo.InvariantCulture)).Append("\n"); stringBuilder.Append("Ran from: ").Append(this.process.StartInfo.FileName).Append("\n"); throw new WebDriverException(stringBuilder.ToString()); } } catch (ThreadStateException) { } } }
public void selects_moved_to_single_method() { var profile = new FirefoxProfile(); var exe = new FirefoxBinary(@"D:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe"); browser = new FirefoxDriver(exe, profile); wait = new WebDriverWait(browser,TimeSpan.FromSeconds(10)); //browser.Navigate().GoToUrl("http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/CascadingDropDown/CascadingDropDown.aspx"); browser.Navigate().GoToUrl("http://localhost/AJAXDemos/CascadingDropDown/CascadingDropDown.aspx"); wait_on_menu_item(1, "Acura"); select_menu_item(1, "Acura"); wait_on_menu_item(2, "Integra"); select_menu_item(2, "Integra"); wait_on_menu_item(3, "Sea Green"); select_menu_item(3, "Sea Green"); wait.Until( ExpectedConditions.ElementExists( By.XPath("//span[@id='ctl00_SampleContent_Label1' and text()='You have chosen a Sea Green Acura Integra. Nice car!']"))); browser.Quit(); }
private static ICommandExecutor CreateExecutor(FirefoxDriverService service, FirefoxOptions options, TimeSpan commandTimeout) { ICommandExecutor executor = null; if (options.UseLegacyImplementation) { // Note: If BrowserExecutableLocation is null or empty, the legacy driver // will still do the right thing, and find Firefox in the default location. FirefoxBinary binary = new FirefoxBinary(options.BrowserExecutableLocation); FirefoxProfile profile = options.Profile; if (profile == null) { profile = new FirefoxProfile(); } executor = CreateExtensionConnection(binary, profile, commandTimeout); } else { if (service == null) { throw new ArgumentNullException("service", "You requested a service-based implementation, but passed in a null service object."); } return(new DriverServiceCommandExecutor(service, commandTimeout)); } return(executor); }
public void InitScenario() { FirefoxOptions options = new FirefoxOptions(); var profile = new FirefoxProfile(); var binary = new FirefoxBinary(@"C:\Program Files (x86)\Mozilla Firefox\firefox.exe"); driver = new FirefoxDriver(binary, profile); }
private static ExtensionConnection CreateExtensionConnection(FirefoxBinary binary, FirefoxProfile profile) { FirefoxProfile profileToUse = profile; // TODO (JimEvans): Provide a "named profile" override. // string suggestedProfile = System.getProperty("webdriver.firefox.profile"); string suggestedProfile = null; if (profileToUse == null && suggestedProfile != null) { profileToUse = new FirefoxProfileManager().GetProfile(suggestedProfile); } else if (profileToUse == null) { profileToUse = new FirefoxProfile(); profileToUse.AddExtension(false); } else { profileToUse.AddExtension(false); } ExtensionConnection extension = ConnectTo(binary, profileToUse, "localhost"); return(extension); }
private Dictionary <string, object> GenerateFirefoxOptionsDictionary() { Dictionary <string, object> firefoxOptions = new Dictionary <string, object>(); if (this.profile != null) { firefoxOptions[FirefoxProfileCapability] = this.profile.ToBase64String(); } if (!string.IsNullOrEmpty(this.browserBinaryLocation)) { firefoxOptions[FirefoxBinaryCapability] = this.browserBinaryLocation; } else { if (!this.isMarionette) { using (FirefoxBinary executablePathBinary = new FirefoxBinary()) { string executablePath = executablePathBinary.BinaryExecutable.ExecutablePath; if (!string.IsNullOrEmpty(executablePath)) { firefoxOptions[FirefoxBinaryCapability] = executablePath; } } } } if (this.logLevel != FirefoxDriverLogLevel.Default) { Dictionary <string, object> logObject = new Dictionary <string, object>(); logObject["level"] = this.logLevel.ToString().ToLowerInvariant(); firefoxOptions[FirefoxLogCapability] = logObject; } if (this.firefoxArguments.Count > 0) { List <object> args = new List <object>(); foreach (string argument in this.firefoxArguments) { args.Add(argument); } firefoxOptions[FirefoxArgumentsCapability] = args; } if (this.profilePreferences.Count > 0) { firefoxOptions[FirefoxPrefsCapability] = this.profilePreferences; } foreach (KeyValuePair <string, object> pair in this.additionalFirefoxOptions) { firefoxOptions.Add(pair.Key, pair.Value); } return(firefoxOptions); }
public WebTestContext() { FirefoxOptions options = new FirefoxOptions(); var profile = new FirefoxProfile(); var binary = new FirefoxBinary(@"C:\Program Files (x86)\Mozilla Firefox\firefox.exe"); if (Driver == null) Driver = new FirefoxDriver(binary, profile); }
public static void Initialize() { var ffbinary = new FirefoxBinary(@"C:\Program Files (x86)\Mozilla Firefox\firefox.exe"); //for Windows 10 Instance = new FirefoxDriver(ffbinary, new FirefoxProfile()); //Instance = new FirefoxDriver(); Instance.Manage() .Timeouts() .ImplicitlyWait(TimeSpan.FromSeconds(5)); }
private static FirefoxOptions CreateOptionsFromCapabilities(ICapabilities capabilities) { // This is awkward and hacky. To be removed when the legacy driver is retired. FirefoxBinary binary = ExtractBinary(capabilities); FirefoxProfile profile = ExtractProfile(capabilities); DesiredCapabilities desiredCaps = RemoveUnneededCapabilities(capabilities) as DesiredCapabilities; FirefoxOptions options = new FirefoxOptions(profile, binary, desiredCaps); return(options); }
public void run_once_before_anything() { var profile = new FirefoxProfile(); var exe = new FirefoxBinary(@"D:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe"); browser = new FirefoxDriver(exe, profile); wait = new WebDriverWait(browser, TimeSpan.FromSeconds(10)); //browser.Navigate().GoToUrl("http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/CascadingDropDown/CascadingDropDown.aspx"); browser.Navigate().GoToUrl("http://localhost/AJAXDemos/CascadingDropDown/CascadingDropDown.aspx"); }
public void Run_once_before_anything() { var profile = new FirefoxProfile(); profile.Clean(); var exe = new FirefoxBinary(); browser = new FirefoxDriver(exe, profile); wait = new WebDriverWait(browser, TimeSpan.FromSeconds(10)); }
/// <summary> /// Returns DesiredCapabilities for Firefox with these options included as /// capabilities. This does not copy the options. Further changes will be /// reflected in the returned capabilities. /// </summary> /// <returns>The DesiredCapabilities for Firefox with these options.</returns> public override ICapabilities ToCapabilities() { DesiredCapabilities capabilities = new DesiredCapabilities(BrowserName, string.Empty, new Platform(PlatformType.Any)); if (this.isMarionette) { ISpecificationCompliant specCompliantCapabilities = capabilities as ISpecificationCompliant; specCompliantCapabilities.IsSpecificationCompliant = true; if (this.proxy != null) { Dictionary <string, object> proxyCapabiity = this.proxy.ToCapability(); if (proxyCapabiity != null) { capabilities.SetCapability(CapabilityType.Proxy, proxyCapabiity); } } Dictionary <string, object> firefoxOptions = this.GenerateFirefoxOptionsDictionary(); capabilities.SetCapability(FirefoxOptionsCapability, firefoxOptions); } else { if (this.profile != null) { if (this.proxy != null) { this.profile.InternalSetProxyPreferences(this.proxy); } capabilities.SetCapability(FirefoxProfileCapability, this.profile.ToBase64String()); } if (!string.IsNullOrEmpty(this.browserBinaryLocation)) { capabilities.SetCapability(FirefoxBinaryCapability, this.browserBinaryLocation); } else { using (FirefoxBinary executablePathBinary = new FirefoxBinary()) { string executablePath = executablePathBinary.BinaryExecutable.ExecutablePath; capabilities.SetCapability(FirefoxBinaryCapability, executablePath); } } } foreach (KeyValuePair <string, object> pair in this.additionalCapabilities) { capabilities.SetCapability(pair.Key, pair.Value); } return(capabilities); }
public void run_once_before_anything() { var profile = new FirefoxProfile(); var exe = new FirefoxBinary(@"D:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe"); browser = new FirefoxDriver(exe, profile); wait = new WebDriverWait(browser, TimeSpan.FromSeconds(10)); string target = Settings.Car_menu_url; browser.Navigate().GoToUrl(target); }
/// <summary> /// Initializes a new instance of the <see cref="FirefoxOptions"/> class for the given profile and binary. /// </summary> /// <param name="profile">The <see cref="FirefoxProfile"/> to use in the options.</param> /// <param name="binary">The <see cref="FirefoxBinary"/> to use in the options.</param> internal FirefoxOptions(FirefoxProfile profile, FirefoxBinary binary) { if (profile != null) { this.profile = profile; } if (binary != null) { this.browserBinaryLocation = binary.BinaryExecutable.ExecutablePath; } }
private void ModifyLinkLibraryPath(FirefoxProfile profile) { string environmentVariable = Environment.GetEnvironmentVariable("LD_LIBRARY_PATH"); string text = FirefoxBinary.ExtractAndCheck(profile, "x_ignore_nofocus.so", "x86", "x64"); if (!string.IsNullOrEmpty(environmentVariable)) { text += environmentVariable; } this.SetEnvironmentProperty("LD_LIBRARY_PATH", text); this.SetEnvironmentProperty("LD_PRELOAD", "x_ignore_nofocus.so"); }
private static ICommandExecutor CreateExtensionConnection(FirefoxBinary binary, FirefoxProfile profile, TimeSpan commandTimeout) { FirefoxProfile firefoxProfile = profile; string environmentVariable = Environment.GetEnvironmentVariable("webdriver.firefox.profile"); if (firefoxProfile == null && environmentVariable != null) { firefoxProfile = new FirefoxProfileManager().GetProfile(environmentVariable); } else if (firefoxProfile == null) { firefoxProfile = new FirefoxProfile(); } return(new FirefoxDriverCommandExecutor(binary, firefoxProfile, "localhost", commandTimeout)); }
public void StartWebBrowser() { FirefoxBinary ffBinary = new FirefoxBinary(ConfigurationSettings.AppSettings["ffBinary"]); // Create a FireFox profile and add the FireBug and FirePath to the browser object FirefoxProfile ffProfile = new FirefoxProfile(); // FireFox Addins are not working when using SpecRun //ffProfile.AddExtension(ConfigurationSettings.AppSettings["firebug"]); //ffProfile.AddExtension(ConfigurationSettings.AppSettings["firepath"]); // Create FireFox Driver object using the profile above Driver.CurrentDriver = new FirefoxDriver(ffBinary, ffProfile); Driver.CurrentDriver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(30)); Driver.CurrentDriver.Manage().Window.Maximize(); }
public void a_bit_easier_to_read() { var profile = new FirefoxProfile(); var exe = new FirefoxBinary(@"D:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe"); IWebDriver browser = new FirefoxDriver(exe, profile); WebDriverWait wait = new WebDriverWait(browser,TimeSpan.FromSeconds(10)); browser.Navigate().GoToUrl("http://localhost/AJAXDemos/CascadingDropDown/CascadingDropDown.aspx"); //browser.Navigate().GoToUrl("http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/CascadingDropDown/CascadingDropDown.aspx"); wait.Until( ExpectedConditions.ElementExists( By.XPath("id('ctl00_SampleContent_DropDownList1')/option[text()='Acura']"))); var selectionList = browser.FindElement( By.Id("ctl00_SampleContent_DropDownList1")); var optionsList = new SelectElement(selectionList); optionsList.SelectByText("Acura"); wait.Until( ExpectedConditions.ElementExists( By.XPath("id('ctl00_SampleContent_DropDownList2')/option[text()='Integra']"))); selectionList = browser.FindElement( By.Id("ctl00_SampleContent_DropDownList2")); optionsList = new SelectElement(selectionList); optionsList.SelectByText("Integra"); wait.Until( ExpectedConditions.ElementExists( By.XPath("id('ctl00_SampleContent_DropDownList3')/option[text()='Sea Green']"))); selectionList = browser.FindElement( By.Id("ctl00_SampleContent_DropDownList3")); optionsList = new SelectElement(selectionList); optionsList.SelectByText("Sea Green"); wait.Until( ExpectedConditions.ElementExists( By.XPath("//span[@id='ctl00_SampleContent_Label1' and text()='You have chosen a Sea Green Acura Integra. Nice car!']"))); browser.Quit(); }
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(); return; } this.process = binary; }
/// <summary> /// Initializes a new instance of the <see cref="FirefoxOptions"/> class for the given profile and binary. /// </summary> /// <param name="profile">The <see cref="FirefoxProfile"/> to use in the options.</param> /// <param name="binary">The <see cref="FirefoxBinary"/> to use in the options.</param> /// <param name="capabilities">The <see cref="DesiredCapabilities"/> to copy into the options.</param> internal FirefoxOptions(FirefoxProfile profile, FirefoxBinary binary, DesiredCapabilities capabilities) { this.BrowserName = BrowserNameValue; if (profile != null) { this.profile = profile; } if (binary != null) { this.browserBinaryLocation = binary.BinaryExecutable.ExecutablePath; } if (capabilities != null) { this.ImportCapabilities(capabilities); } }
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> /// Returns DesiredCapabilities for Firefox with these options included as /// capabilities. This does not copy the options. Further changes will be /// reflected in the returned capabilities. /// </summary> /// <returns>The DesiredCapabilities for Firefox with these options.</returns> public override ICapabilities ToCapabilities() { DesiredCapabilities capabilities = GenerateDesiredCapabilities(this.isMarionette); if (this.isMarionette) { Dictionary <string, object> firefoxOptions = this.GenerateFirefoxOptionsDictionary(); capabilities.SetCapability(FirefoxOptionsCapability, firefoxOptions); } else { if (this.profile != null) { if (this.Proxy != null) { this.profile.InternalSetProxyPreferences(this.Proxy); } capabilities.SetCapability(FirefoxProfileCapability, this.profile.ToBase64String()); } if (!string.IsNullOrEmpty(this.browserBinaryLocation)) { capabilities.SetCapability(FirefoxBinaryCapability, this.browserBinaryLocation); } else { using (FirefoxBinary executablePathBinary = new FirefoxBinary()) { string executablePath = executablePathBinary.BinaryExecutable.ExecutablePath; capabilities.SetCapability(FirefoxBinaryCapability, executablePath); } } } foreach (KeyValuePair <string, object> pair in this.additionalCapabilities) { capabilities.SetCapability(pair.Key, pair.Value); } // Should return capabilities.AsReadOnly(), and will in a future release. return(capabilities); }
private static FirefoxOptions CreateOptionsFromCapabilities(ICapabilities capabilities) { // This is awkward and hacky. To be removed when the legacy driver is retired. FirefoxBinary binary = ExtractBinary(capabilities); FirefoxProfile profile = ExtractProfile(capabilities); DesiredCapabilities desiredCaps = RemoveUnneededCapabilities(capabilities) as DesiredCapabilities; FirefoxOptions options = new FirefoxOptions(profile, binary); if (desiredCaps != null) { Dictionary <string, object> capsDictionary = desiredCaps.ToDictionary(); foreach (KeyValuePair <string, object> capability in capsDictionary) { options.AddAdditionalCapability(capability.Key, capability.Value); } } return(options); }
/// <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; } }
/// <summary> /// BROWSER_TYPEの値によって起動するブラウザを変える /// (firefox以外は不安定) /// </summary> /// <param name="webDriver"></param> public static void SelectBrowser(ref IWebDriver webDriver) { switch (AppConfig.GetString(Config.BROWSER_TYPE)) { case "1": // FireFox FirefoxBinary firefoxBinary = new FirefoxBinary(@"C:\Program Files (x86)\Mozilla Firefox\firefox.exe"); FirefoxProfile firefoxProfile = new FirefoxProfile(); webDriver = new FirefoxDriver(firefoxBinary, firefoxProfile); break; case "2": // Chrome webDriver = new ChromeDriver(); break; case "3": // IE // ブラウザのズームレベルを100%にしないと落ちる webDriver = new InternetExplorerDriver(); break; default: throw new OriginalException("BROWSER_TYPEが不正です。1~3の間で設定してください。"); } webDriver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(10)); webDriver.Url = AppConfig.GetString(Config.TEST_URL); }
/// <summary> /// Returns DesiredCapabilities for Firefox with these options included as /// capabilities. This does not copy the options. Further changes will be /// reflected in the returned capabilities. /// </summary> /// <returns>The DesiredCapabilities for Firefox with these options.</returns> public override ICapabilities ToCapabilities() { DesiredCapabilities capabilities = DesiredCapabilities.Firefox(); capabilities.SetCapability(IsMarionetteCapability, this.isMarionette); if (this.isMarionette) { Dictionary <string, object> firefoxOptions = this.GenerateFirefoxOptionsDictionary(); capabilities.SetCapability(FirefoxOptionsCapability, firefoxOptions); } else { if (this.profile != null) { capabilities.SetCapability(FirefoxProfileCapability, this.profile.ToBase64String()); } if (!string.IsNullOrEmpty(this.browserBinaryLocation)) { capabilities.SetCapability(FirefoxBinaryCapability, this.browserBinaryLocation); } else { using (FirefoxBinary executablePathBinary = new FirefoxBinary()) { string executablePath = executablePathBinary.BinaryExecutable.ExecutablePath; capabilities.SetCapability(FirefoxBinaryCapability, executablePath); } } } foreach (KeyValuePair <string, object> pair in this.additionalCapabilities) { capabilities.SetCapability(pair.Key, pair.Value); } return(capabilities); }
public static async Task<IWebDriver> GetDriverAsync(DriverType typeOfDriver) { IWebDriver browserDriver; switch (typeOfDriver) { case DriverType.Chrome: ChromeOptions co = new ChromeOptions(); browserDriver = await Task.Run(() => new ChromeDriver()); break; case DriverType.IE: InternetExplorerOptions io = new InternetExplorerOptions(); browserDriver = await Task.Run(() => new InternetExplorerDriver()); break; case DriverType.Firefox: default: FirefoxProfile ffp = new FirefoxProfile(); ffp.AcceptUntrustedCertificates = true; FirefoxBinary ffb = new FirefoxBinary(Defaults.FIREFOX_BINARY_PATH); browserDriver = await Task.Run(() => new FirefoxDriver(ffb, ffp)); break; } return browserDriver; }
private static ExtensionConnection CreateExtensionConnection(FirefoxBinary binary, FirefoxProfile profile) { 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(); profileToUse.AddExtension(false); } else { profileToUse.AddExtension(false); } ExtensionConnection extension = ConnectTo(binary, profileToUse, "localhost"); return(extension); }
/// <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) { }
/// <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, TimeSpan.FromSeconds(60)) { }
private static ICommandExecutor CreateExecutor(FirefoxDriverService service, FirefoxOptions options, TimeSpan commandTimeout) { ICommandExecutor executor = null; if (options.UseLegacyImplementation) { // Note: If BrowserExecutableLocation is null or empty, the legacy driver // will still do the right thing, and find Firefox in the default location. FirefoxBinary binary = new FirefoxBinary(options.BrowserExecutableLocation); FirefoxProfile profile = options.Profile; if (profile == null) { profile = new FirefoxProfile(); } executor = CreateExtensionConnection(binary, profile, commandTimeout); } else { if (service == null) { throw new ArgumentNullException("service", "You requested a service-based implementation, but passed in a null service object."); } return new DriverServiceCommandExecutor(service, commandTimeout); } return executor; }
public MarionetteCommandExecutor(FirefoxBinary binary, FirefoxProfile profile) { this.binary = binary; this.profile = profile; this.PopulateCommandNameMap(); }
public FirefoxDriver(FirefoxBinary binary, FirefoxProfile profile) : this(new FirefoxOptions(profile, binary)) { }
/// <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) { }
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; }
private static ExtensionConnection CreateExtensionConnection(FirefoxBinary binary, FirefoxProfile profile) { FirefoxProfile profileToUse = profile; // TODO (JimEvans): Provide a "named profile" override. // string suggestedProfile = System.getProperty("webdriver.firefox.profile"); string suggestedProfile = null; if (profileToUse == null && suggestedProfile != null) { profileToUse = new FirefoxProfileManager().GetProfile(suggestedProfile); } else if (profileToUse == null) { profileToUse = new FirefoxProfile(); profileToUse.AddExtension(false); } else { profileToUse.AddExtension(false); } ExtensionConnection extension = ConnectTo(binary, profileToUse, "localhost"); return extension; }
private static ExtensionConnection CreateExtensionConnection(FirefoxBinary binary, FirefoxProfile profile) { 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(); profileToUse.AddExtension(false); } else { profileToUse.AddExtension(false); } ExtensionConnection extension = ConnectTo(binary, profileToUse, "localhost"); return extension; }
/// <summary> /// Connects the <see cref="FirefoxDriver"/> to a running instance of the WebDriver Firefox extension. /// </summary> /// <param name="binary">The <see cref="FirefoxBinary"/> to use to connect to the extension.</param> /// <param name="profile">The <see cref="FirefoxProfile"/> to use to connect to the extension.</param> /// <param name="host">The host name of the computer running the Firefox browser extension (usually "localhost").</param> /// <returns>A <see cref="ExtensionConnection"/> to the currently running Firefox extension.</returns> internal static ExtensionConnection ConnectTo(FirefoxBinary binary, FirefoxProfile profile, string host) { return ExtensionConnectionFactory.ConnectTo(binary, profile, host); }
/// <summary> /// Connects the <see cref="FirefoxDriver"/> to a running instance of the WebDriver Firefox extension. /// </summary> /// <param name="binary">The <see cref="FirefoxBinary"/> to use to connect to the extension.</param> /// <param name="profile">The <see cref="FirefoxProfile"/> to use to connect to the extension.</param> /// <param name="host">The host name of the computer running the Firefox browser extension (usually "localhost").</param> /// <returns>A <see cref="ExtensionConnection"/> to the currently running Firefox extension.</returns> internal static ExtensionConnection ConnectTo(FirefoxBinary binary, FirefoxProfile profile, string host) { return(ExtensionConnectionFactory.ConnectTo(binary, profile, host)); }
public MarionetteDriver(FirefoxBinary binary, FirefoxProfile profile, int port) : base(CreateCommandExecutor(binary, profile, port), DesiredCapabilities.Firefox()) { }
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 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) : base(CreateExtensionConnection(binary, profile), DesiredCapabilities.Firefox()) { }
/// <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) : base(CreateExtensionConnection(binary, profile, commandTimeout), DesiredCapabilities.Firefox()) { this.binary = binary; this.profile = profile; }
public FirefoxDriver(FirefoxBinary binary, FirefoxProfile profile, TimeSpan commandTimeout) : this((FirefoxDriverService)null, new FirefoxOptions(profile, binary), commandTimeout) { }
/// <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; }
private IWebDriver CreateFireFoxDriver() { var fireFoxBinary = new FirefoxBinary(ConfigurationManager.AppSettings["firefox-binary"]); var fireFoxProfile = new FirefoxProfile(ConfigurationManager.AppSettings["firefox-profile"]); var fireFoxDriver = new FirefoxDriver(fireFoxBinary, fireFoxProfile); return fireFoxDriver; }
public FirefoxDriver(FirefoxBinary binary, FirefoxProfile profile, TimeSpan commandTimeout) : this(null, new FirefoxOptions(profile, binary), commandTimeout) { }
private void SetStartupOptions() { // Firefox binary if (ConfigReader.DefaultProvider.CurrentBrowser.BinaryPath.Enable) { this.binary = new FirefoxBinary(ConfigReader.DefaultProvider.CurrentBrowser.BinaryPath.Path); this.capa.SetCapability( "firefox_binary", ConfigReader.DefaultProvider.CurrentBrowser.BinaryPath.Path); } else { this.binary = new FirefoxBinary(); } // Firefox profile if (ConfigReader.DefaultProvider.CurrentBrowser.ProfilePath.Enable) { this.profile = new FirefoxProfile(ConfigReader.DefaultProvider.CurrentBrowser.ProfilePath.Path); this.capa.SetCapability( "firefox_profile", ConfigReader.DefaultProvider.CurrentBrowser.ProfilePath.Path); } else { this.profile = new FirefoxProfile(); this.profile.AcceptUntrustedCertificates = true; } // SSL certificate exception this.capa.SetCapability("acceptSslCerts", true); // Remote server url this.remoteServerUrl = new Uri(string.Format( "http://{0}:{1}/wd/hub", ConfigReader.DefaultProvider.CurrentBrowser.Server.Host, ConfigReader.DefaultProvider.CurrentBrowser.Server.Port)); }