protected override object HandleSeleneseCommand(IWebDriver driver, string locator, string value) { string waitMessage = "Failed to resolve " + locator; ConditionWaiter waiter = new ConditionWaiter(driver, locator); if (!string.IsNullOrEmpty(value)) { waiter.Wait(waitMessage, long.Parse(value, CultureInfo.InvariantCulture)); } else { waiter.Wait(waitMessage); } return null; }
/// <summary> /// Handles the command. /// </summary> /// <param name="driver">The driver used to execute the command.</param> /// <param name="locator">The first parameter to the command.</param> /// <param name="value">The second parameter to the command.</param> /// <returns>The result of the command.</returns> protected override object HandleSeleneseCommand(IWebDriver driver, string locator, string value) { StringBuilder builder = new StringBuilder(); this.mutator.Mutate(locator, builder); string modified = builder.ToString(); string waitMessage = "Failed to resolve " + locator; ConditionWaiter waiter = new ConditionWaiter(driver, modified); if (!string.IsNullOrEmpty(value)) { waiter.Wait(waitMessage, long.Parse(value, CultureInfo.InvariantCulture)); } else { waiter.Wait(waitMessage); } return null; }
/// <summary> /// Handles the command. /// </summary> /// <param name="driver">The driver used to execute the command.</param> /// <param name="locator">The first parameter to the command.</param> /// <param name="value">The second parameter to the command.</param> /// <returns>The result of the command.</returns> protected override object HandleSeleneseCommand(IWebDriver driver, string locator, string value) { StringBuilder builder = new StringBuilder(); this.mutator.Mutate(locator, builder); string modified = builder.ToString(); string waitMessage = "Failed to resolve " + locator; ConditionWaiter waiter = new ConditionWaiter(driver, modified); if (!string.IsNullOrEmpty(value)) { waiter.Wait(waitMessage, long.Parse(value, CultureInfo.InvariantCulture)); } else { waiter.Wait(waitMessage); } return(null); }
public bool AskAndWait(string request, int delay) { bool result; lock (this.m_conditionWaiter) { try { this.AskingSomething = true; this.logger.Warn(string.Concat(new object[] { request, Environment.NewLine, "[CANCEL IN ", delay, " SECONDS] (y/n)" })); if (ConditionWaiter.WaitFor(() => !this.EnteringCommand && Console.KeyAvailable, delay * 1000, ConsoleBase.AskWaiterInterval)) { string a = Console.ReadLine().ToLower(); this.AskingSomething = false; result = (a == "y" || a == "yes"); } else { this.AskingSomething = false; result = false; } } finally { this.AskingSomething = false; } } return(result); }
protected ConsoleBase() { m_conditionWaiter = new ConditionWaiter(() => !AskingSomething && Console.KeyAvailable, Timeout.Infinite, 20); }
protected ConsoleBase() { Func <bool> predicate = () => !this.AskingSomething && Console.KeyAvailable; this.m_conditionWaiter = new ConditionWaiter(predicate, -1, 20); }