コード例 #1
0
ファイル: StateFinder.cs プロジェクト: rubicon-oss/Fork.coypu
        internal State FindState(State[] states, Scope scope, Options options)
        {
            var query = new LambdaPredicateQuery(() =>
            {
                var was = timingStrategy.ZeroTimeout;
                timingStrategy.ZeroTimeout = true;
                try
                {
                    return(((Func <bool>)(() => states.Any(s => s.CheckCondition())))());
                }
                finally
                {
                    timingStrategy.ZeroTimeout = was;
                }
            }, options);

            var foundState = timingStrategy.Synchronise(query);

            if (!foundState)
            {
                throw new MissingHtmlException("None of the given states was reached within the configured timeout.");
            }

            return(states.First(e => e.ConditionWasMet));
        }
コード例 #2
0
 /// <summary>
 /// Supply a value for the text field
 /// </summary>
 /// <param name="value">The value to fill in</param>
 /// <exception cref="T:Coypu.MissingHtmlException">Thrown if the element cannot be found</exception>
 public void With(string value)
 {
     timingStrategy.Synchronise(new FillIn(driver, element, value, options));
 }
コード例 #3
0
 /// <summary>
 ///     Find the first matching select to appear within the SessionConfiguration.Timeout from which to select this option.
 /// </summary>
 /// <param name="locator">The text of the associated label element, the id or name</param>
 /// <param name="fromOptions">
 /// <para>Override the way Coypu is configured to find elements for this call only.</para>
 /// <para>E.g. A longer wait</para></param>
 /// <exception cref="T:Coypu.MissingHtmlException">Thrown if the element cannot be found</exception>
 public void From(string locator,
                  Options fromOptions)
 {
     _timingStrategy.Synchronise(new Select(_driver, _scope, locator, _option, _disambiguationStrategy, _options, fromOptions));
 }
コード例 #4
0
 public override Element Now()
 {
     return(TimingStrategy.Synchronise(new ElementQuery(this, options)));
 }
コード例 #5
0
 public bool Run()
 {
     tryThis.Act();
     return(timingStrategy.Synchronise(until));
 }
コード例 #6
0
 public void RetryUntilTimeout(Action action, Options options = null)
 {
     timingStrategy.Synchronise(new LambdaBrowserAction(action, Merge(options)));
 }
コード例 #7
0
ファイル: SelectFrom.cs プロジェクト: hnhan/coypu
 /// <summary>
 /// Find the first matching select to appear within the SessionConfiguration.Timeout from which to select this option.
 /// </summary>
 /// <param name="locator">The text of the associated label element, the id or name</param>
 /// <exception cref="T:Coypu.MissingHtmlException">Thrown if the element cannot be found</exception>
 public void From(string locator)
 {
     timingStrategy.Synchronise(new Select(driver, scope, locator, option, options, disambiguationStrategy));
 }