public void Search() { driver.Navigate().GoToUrl("http://google.com/ncr"); driver.FindElement(By.Name("q")).SendKeys("Selenide" + Keys.Enter); /* * new WebDriverWait(driver, TimeSpan.FromSeconds(2)) * .Until( * ExpectedConditions.TextToBePresentInElement( * new GooglePage(driver).Results[0], * "Selenide: concise UI tests in Java" * ) * ); */ new WebDriverWait(driver, TimeSpan.FromSeconds(2)) .Until( CustomConditions.ListNthElementHasText( new GooglePage(driver).Results, 0, "Selenide: concise UI tests in Java" ) ); driver.FindElements(By.CssSelector(".srg>.g"))[0] .FindElement(By.CssSelector("h3>a")).Click(); new WebDriverWait(driver, TimeSpan.FromSeconds(2)).Until( ExpectedConditions.UrlToBe("http://selenide.org/")); }
public void OnInitialize() { Logger.DBLog.DebugFormat("fBaseXtensions OnInitialize Started"); if (File.Exists(FolderPaths.PluginPath + @"\CombatRoutine.cs")) { try { if (File.Exists(FolderPaths.RoutinePath + @"\CombatRoutine.cs")) { File.Delete(FolderPaths.RoutinePath + @"\CombatRoutine.cs"); } File.Copy(FolderPaths.PluginPath + @"\CombatRoutine.cs", FolderPaths.RoutinePath + @"\CombatRoutine.cs"); Logger.DBLog.DebugFormat("fBaseXtensions Copied Combat Routine"); } catch (Exception ex) { Logger.DBLog.DebugFormat("fBaseXtensions Copy Combat Routine Threw Exception", ex); } } Settings = new PluginSettings(); PluginSettings.LoadSettings(); TheCache.ObjectIDCache = new IDCache(); CharacterControl.OrginalGameDifficultySetting = CharacterSettings.Instance.GameDifficulty; BotMain.OnStart += EventHandling.OnBotStart; BotMain.OnStop += EventHandling.OnBotStop; CustomConditions.Initialize(); ObjectCache.FakeCacheObject = new CacheObject(Vector3.Zero, TargetType.None, 0d, "Fake Target", 1f); CharacterSettings.Instance.PropertyChanged += CharacterControl.OnDBCharacterSettingPropertyChanged; Logger.Write("Init Logger Completed!"); Logger.DBLog.DebugFormat("fBaseXtensions OnInitialize Finished"); }
public Cspell(String name, bool stopMove, bool waitIsCast, List <string> Immunity, CustomConditions CustomConditions) : base(name) { this.Name = name; this.stopMove = stopMove; this.waitIsCast = waitIsCast; this.Immunity = Immunity; this.CustomConditions = CustomConditions; }
internal static void WireUp() { BotMain.OnStart += BotMain_OnStart; GameEvents.OnPlayerDied += GameEvents_OnPlayerDied; GameEvents.OnGameChanged += GameEvents_OnGameChanged; GameEvents.OnGameJoined += GameEvents_OnGameJoined; GameEvents.OnWorldChanged += GameEvents_OnWorldChanged; ProfileManager.OnProfileLoaded += ProfileManager_OnProfileLoaded; BotBehaviorQueue.WireUp(); CustomConditions.Initialize(); }
public void Search() { driver.Navigate().GoToUrl("http://google.com/ncr"); driver.FindElement(By.Name("q")).SendKeys("Selenide" + Keys.Enter); new WebDriverWait(driver, TimeSpan.FromSeconds(2)) .Until( CustomConditions.ListNthElementHasText( new GooglePage(driver).Results, 0, "Selenide: concise UI tests in Java" ) ); }
public override void SetupRules() { int maxQueryFailures = RANDOM.Next(1, MAX_ATTEMPTS); int maxUpdateFailures = MAX_ATTEMPTS - maxQueryFailures; Console.WriteLine("Max UPDATE fault failures: " + maxUpdateFailures); Console.WriteLine("Max QUERY fault failures: " + maxQueryFailures); Rules.Add(new FaultRule(MongoRepositoryHelper.Method.UPDATE_CAS, CustomConditions.TriggerRandomlyWithMax(maxUpdateFailures), BuiltInFaults.ThrowExceptionFault(expectedFault))); Rules.Add(new FaultRule(MongoRepositoryHelper.Method.SINGLE, CustomConditions.TriggerRandomly(1, maxQueryFailures), BuiltInFaults.ThrowExceptionFault(expectedFault))); }
public void FollowFirstLink() { driver.Navigate().GoToUrl("http://google.com/ncr"); driver.FindElement(By.Name("q")).SendKeys("Selenide" + Keys.Enter); new WebDriverWait(driver, TimeSpan.FromSeconds(2)) .Until( CustomConditions.minimumSizeOf( new GooglePage(driver).Results, 1 ) ); driver.FindElements(By.CssSelector(".srg>.g"))[0] .FindElement(By.CssSelector("h3>a")).Click(); new WebDriverWait(driver, TimeSpan.FromSeconds(2)).Until( ExpectedConditions.UrlToBe("http://selenide.org/")); }
public PassengerPage ContinueSelect() { _driver.WaitForDocumentReadyState(); _driver.ScrollWindowDown(); var t = FlightSelectContinueButton; //_driver.ScrollIntoViewJS(t); _driver.ScrollWindowDown(); _wait.Timeout = DriverConfig.ExtraWait; _wait.Until(CustomConditions.WizzElementBeEnabled(t)); t.Click(); _wait.Until(CustomConditions.WizzElementBeEnabled(t)); _wait.Timeout = DriverConfig.LowWait; _driver.WaitForDocumentReadyState(); return(new PassengerPage(_driver, _wait)); }
private void Load() { var path = HostingEnvironment.MapPath(@"/config/formEditor.config"); if (string.IsNullOrEmpty(path)) { return; } var configFile = new FileInfo(path); if (configFile.Exists == false) { return; } XDocument configXml = null; try { configXml = XDocument.Load(configFile.FullName); if (configXml.Root == null) { throw new ConfigurationErrorsException("Missing root node in configuration file."); } } catch (Exception ex) { // bad config XML Log.Error(ex, "Could not parse the configuration file."); return; } var customFields = configXml.Root.Element("CustomFields"); if (customFields != null) { CustomFields.AddRange( customFields.Elements("Field").Where(e => e.Attribute("type") != null).Select(e => new CustomField { Name = e.Attribute("name") != null ? e.Attribute("name").Value : "No name", Type = e.Attribute("type").Value, FixedValues = e.Attribute("fixedValues") != null && e.Attribute("fixedValues").Value == "true" } ) ); } var customConditions = configXml.Root.Element("CustomConditions"); if (customConditions != null) { CustomConditions.AddRange( customConditions.Elements("Condition").Where(e => e.Attribute("type") != null).Select(e => new CustomCondition { Name = e.Attribute("name") != null ? e.Attribute("name").Value : "No name", Type = e.Attribute("type").Value } ) ); } var storage = configXml.Root.Element("Storage"); if (storage != null) { var index = storage.Element("Index"); if (index != null) { var type = ParseType(index, typeof(IIndex), t => t.GetConstructors().Any(c => { var parameters = c.GetParameters(); return(parameters.Count() == 1 && parameters.First().ParameterType == typeof(int)); }) ? null : string.Format("Custom Index type \"{0}\" does not contain a constructor that takes an integer (content ID) as it's only parameter", t) ); if (type != null) { IndexType = type; } } } var limitations = configXml.Root.Element("Limitations"); if (limitations != null) { var maxSubmissionsForCurrentUserHandler = limitations.Element("MaxSubmissionsForCurrentUserHandler"); if (maxSubmissionsForCurrentUserHandler != null) { var type = ParseType(maxSubmissionsForCurrentUserHandler, typeof(IMaxSubmissionsForCurrentUserHandler), t => t.GetConstructors().Any(c => c.GetParameters().Any() == false) ? null : string.Format("Custom MaxSubmissionsForCurrentUserHandler type \"{0}\" does not contain a parameterless constructor", t) ); if (type != null) { MaxSubmissionsForCurrentUserHandlerType = type; } } } }
protected void WaitAnswerFromPage() { new WebDriverWait(driver, TimeSpan.FromSeconds(WAIT_TIMEOUT_SECONDS)) .Until(CustomConditions.JQueryAJAXsCompleted(driver)); }