public IWebDriver GetDriver(string driverName) { if (!Drivers.ContainsKey(driverName)) { throw new Exception($"Can't find driver with name {driverName}"); } try { if (RunDrivers.ContainsKey(driverName)) { return(RunDrivers[driverName]); } var resultDriver = Drivers[driverName](); RunDrivers.Add(driverName, resultDriver); if (resultDriver == null) { throw new Exception($"Can't get Webdriver {driverName}. This Driver name not registered"); } return(resultDriver); } catch { throw new Exception("Can't get driver."); } }
public IWebDriver GetDriver(string driverName) { if (!Drivers.ContainsKey(driverName)) { throw new Exception($"Can't find driver with name {driverName}"); } try { IWebDriver result; lock (_locker) { if (RunDrivers.Value == null || !RunDrivers.Value.ContainsKey(driverName)) { var rDrivers = RunDrivers.Value ?? new Dictionary <string, IWebDriver>(); var resultDriver = Drivers[driverName](); if (resultDriver == null) { throw new Exception($"Can't get Webdriver {driverName}. This Driver name is not registered"); } rDrivers.Add(driverName, resultDriver); RunDrivers.Value = rDrivers; } result = RunDrivers.Value[driverName]; } return(result); } catch (Exception e) { throw new Exception($"Can't get driver: {e.Message}; StackTrace: {e.StackTrace}"); } }
public JsonResult AddDriver(string driverName, string NicID, string drivingLicenseID, int age, int yearsOfExperience, int contactNo) { var driverCount = db.drivers.Where(d => d.NicID == NicID).Count(); if (driverCount > 0) { return(Json(new { success = true, Message = "Exsist" }, JsonRequestBehavior.AllowGet)); } else { Drivers driver = new Drivers(); driver.DriverName = driverName; driver.NicID = NicID; driver.DrivingLicenseID = drivingLicenseID; driver.DriverAge = age; driver.YearsOfExperience = yearsOfExperience; driver.ContactNo = contactNo; driver.DriverStatus = "Unoccupied"; driver.WorkingHrsPerDay = 9; driver.LeftWorkingHrsPerDay = 9; DataContext dc2 = new DataContext(); using (dc2) { dc2.drivers.Add(driver); dc2.SaveChanges(); } return(Json(new { success = true, Message = "Success" }, JsonRequestBehavior.AllowGet)); } }
public override void HandleEvent(ref Event Event) { base.HandleEvent(ref Event); if (Event.What == Event.MouseDown) { FocusLink(ref Event); } else if (Event.What == Event.KeyDown) { char C = HotKey(Text); if ((Drivers.GetAltCode(C) == (char)Event.KeyCode) || ((C != '\x0000') && (Owner.Phase == Phases.phPostProcess) && (char.ToUpper((char)Event.CharCode) == C))) { FocusLink(ref Event); } } else { if (Event.What == Event.Broadcast) { if (((Event.Command == cmReceivedFocus) || (Event.Command == cmReleasedFocus)) && (Link != null)) { Light = (Link.State & StateFlags.Focused) != 0; DrawView(); } } } }
private void GetDrivers() { _dbConnection.Open(); using (DbCommand command = _dbConnection.CreateCommand()) { command.CommandText = "SELECT * FROM Drivers"; // TODO add season ID var reader = command.ExecuteReader(); Drivers.Clear(); while (reader.Read()) { Models.Driver driver = new Models.Driver(); driver.FirstName = (string)reader["FirstName"]; driver.LastName = (string)reader["LastName"]; driver.IsLadies = (bool)reader["IsLadies"]; driver.IsNovice = (bool)reader["IsNovice"]; driver.Id = (int)reader["Id"]; driver.SeasonId = (int)reader["SeasonId"]; driver.DriverExists = true; Drivers.Add(driver); } } _dbConnection.Close(); }
public static void StartBrowser(Drivers browser = Drivers.Chrome, int defaultTimeOut = 60) { switch (browser) { case Drivers.Chrome: { Driver.browser = new ChromeDriver(); break; } case Drivers.Firefox: { Driver.browser = new FirefoxDriver(); break; } case Drivers.IE: { InternetExplorerOptions ieOptions = new InternetExplorerOptions(); ieOptions.EnsureCleanSession = true; Driver.browser = new InternetExplorerDriver(ieOptions); break; } } browserWait = new WebDriverWait(Driver.browser, TimeSpan.FromSeconds(defaultTimeOut)); }
public void PositionCars() { Drivers.Add(new FarmerJoe(new Tractor())); Drivers.Add(new Antonio(new FordGt())); Drivers.Add(new SoccerMom(new Minivan())); Drivers.Add(new Joe(new Ferrari())); }
public void PositionCars() { Drivers.Add(new FarmerJoe(new Tractor())); Drivers.Add(new Antonio(new FordGt())); Drivers.Add(new SoccerMom(new Minivan())); Drivers.Add(new ProfessorMark(new SemiTruck())); }
public static void SystemResponse(ZedGraphControl systemGraph, Drivers drivers, bool phaseToggleSum) { double FcLP = 0.0; double FcHP = 0.0; double phaseAtFcLP = 0; double phaseAtFcHP = 0; double splAtFcLP = 0; double splAtFcHP = 0; double[,] groupDelayLP, groupDelayHP, groupDelaySum; double maxLP, maxHP, maxSum; double[,] sum = (new FilterCore().SumResponses(drivers.woofer1.target.splInterpolated, drivers.tweeter.target.splInterpolated)); Curves.AddSummedComplexCurves(systemGraph, sum , Color.Black, "SummedSPL", "SummedSPL", "SummedPhase" , FcLP, splAtFcLP, phaseAtFcLP , FcHP, splAtFcHP, phaseAtFcHP , phaseToggleSum); // Lowpass delay groupDelayLP = GroupDelay.Calculate(drivers.woofer1.target.splInterpolated, out maxLP); // Highpass delay groupDelayHP = GroupDelay.Calculate(drivers.tweeter.target.splInterpolated, out maxHP); // System delay groupDelaySum = GroupDelay.Calculate(sum, out maxSum); var max = (maxLP > maxHP) ? maxLP : maxHP; Curves.AddGroupDelayCurves(systemGraph, groupDelayLP, Color.Violet, "LowpassDelay", "LowpassDelay", curveIsVisible: true, yMax: max); Curves.AddGroupDelayCurves(systemGraph, groupDelayHP, Color.Orange, "HighpassDelay", "HighpassDelay", curveIsVisible: true, yMax: max); Curves.AddGroupDelayCurves(systemGraph, groupDelaySum, Color.Green, "SystemDelay", "SystemDelay", phaseToggleSum, yMax: max); // Data used for graph export FilterSPL.Instance.lowpass = drivers.woofer1.target.splInterpolated; FilterSPL.Instance.highpass = drivers.tweeter.target.splInterpolated; }
public void AddClaim() { try { // Check that a driver has been selected if (Drivers.Contains(SelectedDriver)) { if (Claims.Count < 5) { // Create new claim Claim c = new Claim { Date = ClaimDate }; // Add claim to selected driver Claims.Add(c); } else { Output = "Driver cannot have more than 5 claims"; } } else { Output = "Please select a driver to add a claim"; } } catch (Exception ex) { Output = "An error has occurred. Please ensure that the claim data is correct and try again\n" + ex.Message; } }
public void PositionCars() { Drivers.Add(new FarmerJoe(new Tractor())); Drivers.Add(new Antonio(new FordGt())); Drivers.Add(new SoccerMom(new Minivan())); Drivers.Add(new GroupOfClowns(new ClownCar())); }
public void setDocument(int documentID, string documentName, string url, float totalPrice, string comments, string date, int documentTypeID, int driverID, string containerID, int orderID, string func) { DateTime dt; if (date.Contains(".") || date.Contains("-")) { dt = DateTime.Parse(date); } else { dt = DateTime.ParseExact(date, "dd/MM/yyyy", CultureInfo.InvariantCulture); } Drivers driver = new Drivers(); driver.DriverID = driverID; Drivers sendBy = driver.getDriver(); Orders order = new Orders(); order.OrderID = orderID; Orders relatedOrder = order.getOrder(); Documents d = new Documents(documentID, documentName, url, totalPrice, comments, containerID, dt, new DocumentTypes(documentTypeID, ""), sendBy, relatedOrder); d.setDocument(func); }
private void button_Enter_Click(object sender, EventArgs e) { if (String.IsNullOrEmpty(NameField.Text) || String.IsNullOrEmpty(SurnameField.Text) || String.IsNullOrEmpty(FathernameField.Text) || String.IsNullOrEmpty(CategoryField.Text) || String.IsNullOrEmpty(LoginField.Text) || String.IsNullOrEmpty(PasswordField.Text) || String.IsNullOrEmpty(SalaryField.Text)) { MessageBox.Show("Проверьте заполнение полей, поля не должны быть пустыми."); return; } int Salary = 0; if (int.TryParse(SalaryField.Text, out Salary) == false) { MessageBox.Show("Оклад должен быть числом."); return; } if (Users.isExists(LoginField.Text)) { MessageBox.Show("Данный логин уже существует."); return; } Users.addUser(LoginField.Text, PasswordField.Text, Roles.Driver); Drivers.addDriver(LoginField.Text, NameField.Text, SurnameField.Text, FathernameField.Text, CategoryField.Text, Salary); MessageBox.Show(currentState == false ? "Вы были успешно зарегистрированы." : "Вы успешно добавили водителя."); this.Close(); }
public void setDriverConstraint(int driverConstraintID, string startdate, string enddate, int driverID, string comments, string func) { DateTime dtStart; DateTime dtFinish; if (startdate.Contains(".")) { dtStart = DateTime.Parse(startdate); } else { dtStart = DateTime.ParseExact(startdate, "dd/MM/yyyy", CultureInfo.InvariantCulture); } if (enddate.Contains(".")) { dtFinish = DateTime.Parse(enddate); } else { dtFinish = DateTime.ParseExact(enddate, "dd/MM/yyyy", CultureInfo.InvariantCulture); } DateTime dt = dtStart; while (dt <= dtFinish) { Drivers tmp = new Drivers(); Drivers d = new Drivers(); tmp.DriverID = driverID; d = tmp.getDriver(); DriverConstraints dc = new DriverConstraints(driverConstraintID, dt, d, comments); dc.setDriverConstraint(func); dt = dt.AddDays(1); } }
public void deactivateDriver(int driverID, string active) { Drivers d = new Drivers(); d.DriverID = driverID; d.deactivateDriver(active); }
public async Task ClearAsync() { Taxis.RemoveRange(Taxis.ToArray()); Drivers.RemoveRange(Drivers.ToArray()); Rides.RemoveRange(Rides.ToArray()); await SaveChangesAsync(); }
public InfoPage(String Login, String Role) { InitializeComponent(); label_Role.Text = Role; if (Role == "Driver") { var DriverInfo = Drivers.getDriverByLogin(Login); label_Category.Text = DriverInfo.Category; label_Fathername.Text = DriverInfo.Fathername; label_Name.Text = DriverInfo.Name; label_Salary.Text = DriverInfo.Salary.ToString(); label_Surname.Text = DriverInfo.Surname; WaybillTable.Visible = true; List <WaybillModel> waybills = Waybills.getWaybillList().Where(item => item.DriverId == DriverInfo.Id).ToList(); foreach (var item in waybills) { var currentTransport = Transport.getTransportById(item.TransportId); WaybillTable.Rows.Add(new string[] { currentTransport.Type, item.Distance.ToString(), item.Price.ToString() }); } } }
/// <summary> /// Save selected button handler /// </summary> private async void SaveSelectedDrivers() { //Update Drivers for backup count property MaximumProgress = DriversForBackpCount; MessageDialog = null; //check for empty selection if (!Drivers.Any(x => x.IsSelected)) { MessageDialog = new MessageDialogViewModel(new ObservableCollection <ActionButton>(new List <ActionButton>() { new ActionButton(StringResources.OK, () => { MessageDialog = null; }, ActionButton.ButtonType.Deafult) }), StringResources.NothingToSave, StringResources.NoDriversSelected); return; } var folder = new FolderBrowserDialog(); if (folder.ShowDialog() != DialogResult.OK) { return; } string path = folder.SelectedPath; Progress = 0; ShowInProgressDialog = true; InProgressTest = StringResources.SavingDriversDots; cts = new CancellationTokenSource(); await SaveDriversAsync(Drivers.Where(x => x.IsSelected), path, cts.Token); }
public static String DriverIDToCarZP(string id) { if (id == "0" || id == "-1" || String.IsNullOrWhiteSpace(id)) { return("__________________________________"); } var driver = new Drivers { ID = Convert.ToInt32(id) }; driver.GetById(); if (driver.CarID == 0) { return("__________________________________"); } var car = new Cars { ID = Convert.ToInt32(driver.CarID) }; car.GetById(); if (String.IsNullOrEmpty(car.Model)) { return("__________________________________"); } return(car.Model + " " + car.Number); }
public string GetLeaderboard() { StringBuilder sb = new StringBuilder(); sb.Append("Lap "); sb.Append(CurrentLap.ToString()); sb.Append("/"); sb.AppendLine(LapsNumber.ToString()); int position = 1; foreach (Driver driver in Drivers.OrderBy(x => x.TotalTime)) { sb.AppendFormat($"{position} {driver.Name} "); sb.AppendFormat($"{driver.TotalTime:f3}" + Environment.NewLine); position++; } foreach (Driver driver in FailedDrivers) { sb.AppendFormat($"{position} {driver.Name} "); sb.AppendLine(driver.FailureReason + Environment.NewLine); position++; } return(sb.ToString()); }
public Action <IEnvelope> Handle(NewMotoristMessage message) { var driver = Factory.CreateNewDriver(message.SSN, message.FirstName, message.LastName, message.DateOfBirth); Drivers.RegisterActor(driver.SSN, driver); return(x => x.Acknowledge()); }
public async Task <IActionResult> Edit(int id, [Bind("DriverId,FirstName,LastName,Condition,StartAddress,StartCity,StartZipCode,Longitude,Lattitude,BusId")] Drivers drivers) { if (id != drivers.DriverId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(drivers); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DriversExists(drivers.DriverId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(drivers)); }
public void GetMaxCombosByBlade() { var drivers = new Drivers(); var graph = new ElementComboTeams(drivers.Team); graph.GroupPrintTeams(); }
public void PositionCars() { Drivers.Add(new FarmerJoe(new Tractor())); Drivers.Add(new Antonio(new FordGt())); Drivers.Add(new SoccerMom(new Minivan())); Drivers.Add(new Steph(new OutLander())); }
public override void Tick() { base.Tick(); CheckCheckpointsBlips(); sprintGUI.Draw(Drivers.FirstOrDefault(x => x.IsPlayer)?.RacePosition, time); }
public void Finish() { IsRacing = false; var player = Drivers.FirstOrDefault(x => x.IsPlayer); BigMessageThread.MessageInstance.ShowRankupMessage("Finish", time.ToString(@"mm\:ss\:fff"), player.RacePosition); }
public CreateUserSteps() { _driverFactory = new Drivers(); _driver = _driverFactory.GetChromDriver(); _homePagePOM = new HomePagePOM(_driver); _createAccountPOM = new CreateAccountPOM(_driver); }
public override void OnAppearing() { UserDialogs.Instance.ShowLoading(); Device.BeginInvokeOnMainThread(async() => { var x = await Carrepository.GetAllAsync(); foreach (var item in x) { if (!Cars.Contains(item)) { Cars.Add(item); } } var d = await DriverRepo.GetAllAsync(); foreach (var item in d) { if (!Drivers.Contains(item)) { Drivers.Add(item); } } UserDialogs.Instance.HideLoading(); }); base.OnAppearing(); }
private void button_Edit_Click(object sender, EventArgs e) { if (String.IsNullOrEmpty(NameField.Text) || String.IsNullOrEmpty(SurnameField.Text) || String.IsNullOrEmpty(FathernameField.Text) || String.IsNullOrEmpty(CategoryField.Text) || String.IsNullOrEmpty(PasswordField.Text) || String.IsNullOrEmpty(SalaryField.Text)) { MessageBox.Show("Проверьте заполнение полей, поля не должны быть пустыми."); return; } if (PasswordField.Text != oldPassword) { Users.eraseByLogin(comboBox_SelectName.Text); Users.addUser(comboBox_SelectName.Text, PasswordField.Text, Roles.Driver); } int Salary = 0; if (int.TryParse(SalaryField.Text, out Salary) == false) { MessageBox.Show("Оклад должен быть числом."); return; } Drivers.eraseByLogin(comboBox_SelectName.Text); Drivers.addDriver(comboBox_SelectName.Text, NameField.Text, SurnameField.Text, FathernameField.Text, CategoryField.Text, Salary); MessageBox.Show("Данный водитель был успешно отредактирован."); Close(); }
internal static IWebDriver GetDriver(Drivers driver) { var outPutDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); var relativePath = @"..\..\..\Framework\Drivers"; var chromeDriverPath = Path.GetFullPath(Path.Combine(outPutDirectory, relativePath)); return new ChromeDriver(chromeDriverPath); }
public void DriverBoxes(List <string> commandArgs) { string reasonToBox = commandArgs[0]; string driversName = commandArgs[1]; Driver boxingDriver = Drivers.Find(d => d.Name == driversName); string tyreTypeOrFuelAmount = commandArgs[2]; if (reasonToBox == "ChangeTyres") { List <string> tyreFactoryArgs = new List <string> { tyreTypeOrFuelAmount }; string tyreHardness = commandArgs[3]; tyreFactoryArgs.Add(tyreHardness); if (tyreTypeOrFuelAmount == "Ultrasoft") { string grip = commandArgs[4]; tyreFactoryArgs.Add(grip); } boxingDriver.Car.ReplaceTyre(TyreFactory.CreateInstance(tyreFactoryArgs)); } else { boxingDriver.Car.Refuel(double.Parse(tyreTypeOrFuelAmount)); } }
public static void CreateInstance(DesiredCapabilities caps, Drivers driver, double timeout) { DefaultTimeoutValue = timeout; lock (syncRoot) { _instance = _CreateInstance(caps, driver); } }
/// <summary> /// 创建一个新的SQL客户端 /// </summary> /// <param name="driver">驱动类型</param> /// <param name="connectionName">配置文件中的连接字符串的Name字段的值</param> /// <returns>SQL客户端</returns> public Sql.SqlClient CreateSqlClient(Drivers driver, string connectionName) { switch (driver) { default: return new Sql.FireBirdClient(connectionName); case Drivers.FireBird: return new Sql.FireBirdClient(connectionName); } }
public Driver NewWebDriver(Type driverType, Drivers.Browser browser) { try { var driver = (Driver)Activator.CreateInstance(driverType, browser); OpenDrivers++; return driver; } catch (TargetInvocationException e) { throw e.InnerException; } }
public static IWebDriver GetDriver(StartDriverCmdletBase cmdlet, Drivers driverType) { try { // enumerate driver processes before creating new one SeHelper.CollectDriverProcesses(driverType); switch (driverType) { // case Drivers.Chrome: // //SeHelper.CollectDriverProcesses(Drivers.Chrome); //// ChromeOptions optCh = //// new ChromeOptions(); // // ChromeOptions optCh = //OptionsFactory.GetChromeOptions(); // // resolve ChromeOptions // WebDriverFactory.Container.Resolve<ChromeOptions>(); // // // 20121003 // //driver = new ChromeDriver(optCh); // // // 20121003 // OpenQA.Selenium.Chrome.ChromeDriverService chromeService = OpenQA.Selenium.Chrome.ChromeDriverService.CreateDefaultService(); // //cmdlet.WriteObject(cmdlet, chromeService.ServiceUrl); // //cmdlet.WriteObject(cmdlet, chromeService); // //chromeService.Start(); // // driver = new ChromeDriver(chromeService, optCh, TimeSpan.FromSeconds(60)); // // SeHelper.GetDriverProcess(Drivers.Chrome, driver.Title + SeHelper.DriverTitleComplementChrome); // break; case Drivers.Firefox: //SeHelper.CollectDriverProcesses(Drivers.Firefox); // 20121003 //FirefoxProfile ffProfile = new FirefoxProfile(); //ffProfile.AcceptUntrustedCertificates = true; //ffProfile.EnableNativeEvents = true; ////driver = new FirefoxDriver(); //driver = new FirefoxDriver(ffProfile); // 20121003 // ICapabilities ffCapabilities = // new OpenQA.Selenium.Support.Events.WebElementEventArgs // ICapabilities ffCapabilities = // new DesiredCapabilities(); ICapabilities ffCapabilities = CapabilitiesFactory.GetCapabilities(); driver = new FirefoxDriver(ffCapabilities); SeHelper.GetDriverProcess(Drivers.Firefox, driver.Title + SeHelper.DriverTitleComplementFirefox.Substring(3)); driver.Manage().Timeouts().SetScriptTimeout(System.TimeSpan.FromSeconds(60)); break; // case Drivers.InternetExplorer: // //OpenQA.Selenium.IE.InternetExplorerOptions optIE = // // new InternetExplorerOptions(); // //optIE. //// InternetExplorerOptions optIE = //// new InternetExplorerOptions(); // // //InternetExplorerOptions optIE = OptionsFactory.GetIEOptions(); // InternetExplorerOptions optIE = // WebDriverFactory.Container.Resolve<InternetExplorerOptions>(); // // optIE.EnableNativeEvents = true; // optIE.IgnoreZoomLevel = true; // optIE.IntroduceInstabilityByIgnoringProtectedModeSettings = true; // // // //SeHelper.CollectDriverProcesses(Drivers.InternetExplorer); // // //string ieSubFolder = string.Empty; // // 20120901 // //System.Reflection.Assembly[] assms = // // System.AppDomain.CurrentDomain.GetAssemblies(); // //foreach (System.Reflection.Assembly assm in assms) { // // if (assm.FullName.Contains("SePSX")) { // // ieSubFolder = // // assm.Location.Substring(0, assm.Location.LastIndexOf('\\')); // // break; // // } // //} // // string ieSubFolder = System.IO.Path.GetDirectoryName(cmdlet.GetType().Assembly.Location); // // if (cmdlet.Architecture == InternetExplorer.x86) { // ieSubFolder += "\\32\\"; // } // if (cmdlet.Architecture == InternetExplorer.x64) { // ieSubFolder += "\\64\\"; // } // // // //driver = new InternetExplorerDriver( // // // 20121003 // OpenQA.Selenium.DriverService ieService = OpenQA.Selenium.IE.InternetExplorerDriverService.CreateDefaultService(ieSubFolder); // // ieService.Start(); // // // driver = new InternetExplorerDriver(ieService, optIE, TimeSpan.FromSeconds(10)); // // // 20121003 // //driver = new InternetExplorerDriver(ieSubFolder, optIE); // // SeHelper.GetDriverProcess(Drivers.InternetExplorer, driver.Title + SeHelper.DriverTitleComplementInternetExplorer); // break; case Drivers.Safari: //SeHelper.CollectDriverProcesses(Drivers.Safari); //driver = new SafariDriver(); //driver = WebDriverFactory.GetNativeDriver(driverType); driver = GetNativeDriver(driverType); SeHelper.GetDriverProcess(Drivers.Safari, driver.Title + SeHelper.DriverTitleComplementSafari); break; case Drivers.HTML: driver = new RemoteWebDriver(DesiredCapabilities.HtmlUnit()); break; default: throw new Exception("Invalid value for Drivers"); } // // //return (new FirefoxDriver()); return driver; // // } catch (Exception ee) { Console.WriteLine(ee.Message); return null; } }
public StubDriver(Drivers.Browser browser){}
public static void DecrementRefCount(Drivers.Framework.Object anObj) { }
internal static IWebDriver GetNativeDriver(Drivers driverType) { try { // //[Inject] // [Ninject.Inject] // IWebDriver driver = null; // [InjectAttribute] IWebDriver nativeDriver = null; switch (driverType) { case Drivers.Chrome: break; case Drivers.Firefox: break; case Drivers.InternetExplorer: break; case Drivers.Safari: nativeDriver = NativeDriver; //new SafariDriver(); break; case Drivers.HTML: break; default: throw new Exception("Invalid value for Drivers"); } //return driver; //return NativeDriver; return nativeDriver; } catch (Exception ee) { Console.WriteLine(ee.Message); return null; } }
internal static HandleRef getCPtr(Drivers obj) { return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; }
public static Drivers factory() { Drivers ret = new Drivers(yarpPINVOKE.Drivers_factory(), false); return ret; }
public CustomFirefoxProfileSeleniumWebDriver(Drivers.Browser browser) : base(CustomProfile(), browser) { }
internal static IWebDriver GetDriver(Drivers driver) { //added to handle the firefox driver switch (driver) { case Drivers.Chrome: var outPutDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); var relativePath = @"..\..\..\Framework\Drivers"; var chromeDriverPath = Path.GetFullPath(Path.Combine(outPutDirectory, relativePath)); return new ChromeDriver(chromeDriverPath); case Drivers.Firefox: return new FirefoxDriver(); default: throw new NotImplementedException("I do not know the driver that you supplied."); } }
private static IWebDriver _CreateInstance(DesiredCapabilities caps, Drivers driver) { IWebDriver _webdriver = null; if (caps == null) { // // Loaded default caps for RemoteWebDriver from Selenium.Tests.dll.config in current Dll directory // See brian.ku about user/key // caps = new DesiredCapabilities(); caps.SetCapability("browserstack.user", ConfigurationManager.AppSettings["browserstack.user"]); caps.SetCapability("browserstack.key", ConfigurationManager.AppSettings["browserstack.key"]); caps.SetCapability("browser", ConfigurationManager.AppSettings["browser"]); caps.SetCapability("browser_version", ConfigurationManager.AppSettings["browser_version"]); caps.SetCapability("os", ConfigurationManager.AppSettings["os"]); caps.SetCapability("os_version", ConfigurationManager.AppSettings["os_version"]); caps.SetCapability("resolution", ConfigurationManager.AppSettings["resolution"]); caps.SetCapability("browserstack.debug", ConfigurationManager.AppSettings["browserstack.debug"]); caps.SetCapability("browserstack.local", ConfigurationManager.AppSettings["browserstack.local"]); } switch (driver) { case Drivers.IEDriver: InternetExplorerDriverService ieService = InternetExplorerDriverService.CreateDefaultService(); _webdriver = new InternetExplorerDriver(ieService, new InternetExplorerOptions(), TimeSpan.FromSeconds(3 * 60)); break; case Drivers.ChromeDriver: ChromeOptions chromeOptions = new ChromeOptions(); chromeOptions.AddExcludedArgument("ignore-certifcate-errors"); chromeOptions.AddArgument("test-type"); _webdriver = new ChromeDriver(chromeOptions); _webdriver.Manage().Window.Maximize(); break; case Drivers.FirefoxDriver: FirefoxProfile profile = new FirefoxProfile(); _webdriver = new FirefoxDriver(profile); _webdriver.Manage().Window.Maximize(); break; case Drivers.BrowserStack: caps.SetCapability("ensureCleanSession", true); _webdriver = new RemoteWebDriver(new Uri(ConfigurationManager.AppSettings["remotewebdriver_url"]), caps); //_webdriver.Manage().Window.Maximize(); break; case Drivers.LocalStack: // // Start the local BrowserStack proxy for cloud browser access // bool bConnected = false; do { // // Reset the stdout capture // sbOutput = new StringBuilder(); // // check if connection succeeeded // bConnected = LaunchBrowserStackLocalProcess(); } while (!bConnected); _webdriver = new RemoteWebDriver(new Uri(ConfigurationManager.AppSettings["remotewebdriver_url"]), caps, TimeSpan.FromMinutes(5.0)); break; } // // Set an implicit timeout for all FindElements // _webdriver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(Factory.DefaultTimeoutValue)); return _webdriver; }
//------------------------------------------------------------------ public Input(Drivers.Player player) { this.player = player; Initial = new Generic (CheckInput); }
public void NotifyOfftrackLimit(Drivers.DriverOfftrackLimit limit) { this.IsShowingOfftrackMessage = true; this.DriverOfftrackLimit = limit; }
protected override void BeginProcessing() { this.CheckCmdletParameters(); switch (this.DriverName.ToUpper()) { case SeHelper.driverNameChrome: case SeHelper.driverNameChrome2: this.CH = true; this.DriverType = Drivers.Chrome; break; case SeHelper.driverNameFirefox: case SeHelper.driverNameFirefox2: this.FF = true; this.DriverType = Drivers.Firefox; break; case SeHelper.driverNameInternetExplorer: case SeHelper.driverNameInternetExplorer2: case SeHelper.driverNameInternetExplorer3: case SeHelper.driverNameInternetExplorer4: case SeHelper.driverNameInternetExplorer5: case SeHelper.driverNameInternetExplorer6: this.IE = true; this.DriverType = Drivers.InternetExplorer; break; default: this.WriteError( this, "Could not determine the type of driver.", "DriverType", ErrorCategory.InvalidArgument, true); break; } SeStartWebDriverCommand command = new SeStartWebDriverCommand(this); //WebDriverFactory.Container.Resolve<SeStartWebDriverCommand>(new NamedParameter("cmdlet", this)); command.Execute(); }