当前位置: 首页>>代码示例>>C#>>正文


C# Constraints.Constraint类代码示例

本文整理汇总了C#中WatiN.Core.Constraints.Constraint的典型用法代码示例。如果您正苦于以下问题:C# Constraint类的具体用法?C# Constraint怎么用?C# Constraint使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Constraint类属于WatiN.Core.Constraints命名空间,在下文中一共展示了Constraint类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Initialize

        public void Initialize(string cssSelector, string markerClass)
        {
            _cssSelector = cssSelector;
            _markerClass = markerClass;

            ActualConstraint = new MarkerConstraint(markerClass);
        }
开发者ID:fschwiet,项目名称:WatiN-2.0.20.1089-net-2.0,代码行数:7,代码来源:CssSelectorConstraint.cs

示例2: GetData

 /// <summary>
 /// Gets previously saved constraint-specific data from the context.
 /// </summary>
 /// <param name="constraint">The constraint that wishes to retrieve its state</param>
 /// <returns>The saved data, or null if none saved</returns>
 /// <exception cref="ArgumentNullException">Thrown if <paramref name="constraint"/> is null</exception>
 public object GetData(Constraint constraint)
 {
     object value;
     if (data != null && data.TryGetValue(constraint, out value))
         return value;
     return null;
 }
开发者ID:modulexcite,项目名称:FluentSharp_Fork.WatiN,代码行数:13,代码来源:ConstraintContext.cs

示例3: NotConstraint

        /// <summary>
        /// Creates a new NOT constraint.
        /// </summary>
        /// <param name="inner">The inner constraint</param>
        /// <exception cref="ArgumentNullException">Thrown if <paramref name="inner"/> is null</exception>
        public NotConstraint(Constraint inner) 
		{
            if (inner == null)
                throw new ArgumentNullException("inner");

            this.inner = inner;
		}
开发者ID:pusp,项目名称:o2platform,代码行数:12,代码来源:NotConstraint.cs

示例4: Filter

        /// <summary>
        /// Creates a new finder filtered by an additional constraint.
        /// </summary>
        /// <param name="constraint">The additional constraint</param>
        /// <returns>The filtered element finder</returns>
        /// <exception cref="ArgumentNullException">Thrown if <paramref name="constraint"/> is null</exception>
        public ElementFinder Filter(Constraint constraint)
        {
            if (constraint == null)
                throw new ArgumentNullException("constraint");

            return FilterImpl(constraint);
        }
开发者ID:modulexcite,项目名称:FluentSharp_Fork.WatiN,代码行数:13,代码来源:ElementFinder.cs

示例5: TryFindIe

        public IE TryFindIe(Constraint findBy, SimpleTimer timer)
        {
            var action = new TryFuncUntilTimeOut(timer)
            {
                SleepTime = TimeSpan.FromMilliseconds(500)
            };

            return action.Try(() => FindIEPartiallyInitialized(findBy));
        }
开发者ID:modulexcite,项目名称:FluentSharp_Fork.WatiN,代码行数:9,代码来源:AttachToIeHelper.cs

示例6: OrConstraint

        /// <summary>
        /// Creates a new OR constraint.
        /// </summary>
        /// <param name="first">The first constraint</param>
        /// <param name="second">The second constraint</param>
        /// <exception cref="ArgumentNullException">Thrown if <paramref name="first"/> or <paramref name="second"/> is null</exception>
        public OrConstraint(Constraint first, Constraint second) 
		{
            if (first == null)
                throw new ArgumentNullException("first");
            if (second == null)
                throw new ArgumentNullException("second");

            this.first = first;
            this.second = second;
        }
开发者ID:modulexcite,项目名称:FluentSharp_Fork.WatiN,代码行数:16,代码来源:OrConstraint.cs

示例7: NativeElementFinder

        /// <summary>
        /// Creates an element finder.
        /// </summary>
        /// <param name="domContainer">The DOM container</param>
        /// <param name="factory">The factory to get the element(s) to search in</param>
        /// <param name="elementTags">The element tags considered by the finder, or null if all tags considered</param>
        /// <param name="constraint">The constraint used by the finder to filter elements, or null if no additional constraint</param>
        public NativeElementFinder(NativeElementCollectionFactory factory, DomContainer domContainer, IList<ElementTag> elementTags, Constraint constraint)
            : base(elementTags, constraint)
        {
            if (factory == null)
                throw new ArgumentNullException("factory");
            if (domContainer == null)
                throw new ArgumentNullException("domContainer");

            this.factory = factory;
            this.domContainer = domContainer;
        }
开发者ID:fschwiet,项目名称:WatiN-2.0.20.1089-net-2.0,代码行数:18,代码来源:NativeElementFinder.cs

示例8: GetIdHint

        /// <summary>
        /// Gets the id hint. Only returns an Id if <paramref name="constraint"/> is an <see cref="AttributeConstraint"/> on an exact Id or
        /// if the <paramref name="constraint"/> is an <see cref="AndConstraint"/> with an <see cref="AttributeConstraint"/> on an exact Id 
        /// and an <see cref="AnyConstraint"/>.
        /// </summary>
        /// <param name="constraint">The constraint to get the id Hint from.</param>
        /// <returns></returns>
        public static string GetIdHint(Constraint constraint)
        {
            var andConstraint = constraint as AndConstraint;
            if (andConstraint != null)
            {
                var left = new IdHinter(andConstraint.First);
                var right = new IdHinter(andConstraint.Second);

                return left.GetIdHint(right);
            }

            return new IdHinter(constraint).GetIdHint();
        }
开发者ID:fschwiet,项目名称:WatiN-2.0.20.1089-net-2.0,代码行数:20,代码来源:IdHinter.cs

示例9: FindIEPartiallyInitialized

        public IE FindIEPartiallyInitialized(Constraint findBy)
        {
            var allBrowsers = new ShellWindows2();

            var context = new ConstraintContext();
            foreach (IWebBrowser2 browser in allBrowsers)
            {
                var ie = CreateBrowserInstance(new IEBrowser(browser));
                if (ie.Matches(findBy, context))
                    return ie;
            }

            return null;
        }
开发者ID:modulexcite,项目名称:FluentSharp_Fork.WatiN,代码行数:14,代码来源:AttachToIeHelper.cs

示例10: SetData

 /// <summary>
 /// Saves constraint-specific data in the context.
 /// </summary>
 /// <param name="constraint">The constraint that wishes to store its state</param>
 /// <param name="value">The value to be stored, or null if none</param>
 /// <exception cref="ArgumentNullException">Thrown if <paramref name="constraint"/> is null</exception>
 public void SetData(Constraint constraint, object value)
 {
     if (value == null)
     {
         if (data != null)
             data.Remove(constraint);
     }
     else
     {
         if (data == null)
             data = new Dictionary<Constraint, object>();
         data[constraint] = value;
     }
 }
开发者ID:modulexcite,项目名称:FluentSharp_Fork.WatiN,代码行数:20,代码来源:ConstraintContext.cs

示例11: Find

        public Browser Find(Constraint findBy, int timeout, bool waitForComplete)
        {
        	Logger.LogAction((LogFunction log) => { log("Busy finding Internet Explorer matching constraint {0}", findBy); });

            var timer = new SimpleTimer(TimeSpan.FromSeconds(timeout));

            var ie = TryFindIe(findBy, timer);
            
            if (ie != null)
            {
                return FinishInitializationAndWaitForComplete(ie, timer, waitForComplete);
            }

            throw new BrowserNotFoundException("IE", findBy.ToString(), timeout);
        }
开发者ID:modulexcite,项目名称:FluentSharp_Fork.WatiN,代码行数:15,代码来源:AttachToIeHelper.cs

示例12: SelectByTextOrValueMultiple

        private static void SelectByTextOrValueMultiple(this SelectList selectList, Constraint constraint)
        {
            // This is copied from SelectList.SelectMultiple
            var options = selectList.Options.Filter(constraint);
            if (options.Count == 0)
                throw new SelectListItemNotFoundException(constraint.ToString(), selectList);

            foreach (var option in options)
            {
                if (option.Selected) continue;
                option.SetAttributeValue("selected", "true");
            }

            selectList.FireEvent("onchange");
        }
开发者ID:JamieBenson,项目名称:coypu,代码行数:15,代码来源:SelectListExtensions.cs

示例13: Find

        public Browser Find(Constraint findBy, int timeout, bool waitForComplete)
        {
            Logger.LogAction("Busy finding FireFox matching constraint {0}", findBy);

            var action = new TryFuncUntilTimeOut(TimeSpan.FromSeconds(timeout)) { SleepTime = TimeSpan.FromMilliseconds(500) };
            var fireFox = action.Try(() => FindFireFox(findBy));

            if (fireFox != null)
            {
                if (waitForComplete) fireFox.WaitForComplete();
                return fireFox;
            }

            throw new BrowserNotFoundException("FireFox", findBy.ToString(), timeout);
        }
开发者ID:pusp,项目名称:o2platform,代码行数:15,代码来源:AttachToFireFoxHelper.cs

示例14: WatiNWindow

 public WatiNWindow (Constraint windowHandle)
 {
     this.windowHandle = windowHandle;
     try
     {
         if (!WatiN.Core.Browser.Exists<IE>(windowHandle))
             throw new MissingWindowException("No such window found: " + windowHandle);
         
         browser = WatiN.Core.Browser.AttachTo<IE>(windowHandle);
     }
     catch (WatiN.Core.Exceptions.BrowserNotFoundException)
     {
         throw new MissingWindowException("No such window found: " + windowHandle);
     }
 }
开发者ID:Br3ttl3y,项目名称:coypu,代码行数:15,代码来源:WatinWindow.cs

示例15: FindFireFox

        public FireFox FindFireFox(Constraint findBy)
        {
            var clientPort = FireFox.GetClientPort();
            clientPort.ConnectToExisting();
            
            var ffBrowser = new FFBrowser(clientPort);
            var windowCount = ffBrowser.WindowCount;

            for (var i = 0; i < windowCount; i++)
            {
                ((FireFoxClientPort)ffBrowser.ClientPort).DefineDefaultJSVariablesForWindow(i);
                ffBrowser.ClientPort.InitializeDocument();
                var firefox = CreateBrowserInstance(ffBrowser);
                if (firefox.Matches(findBy)) 
                    return firefox;
            }

            clientPort.CloseConnection();

            return null;
        }
开发者ID:modulexcite,项目名称:FluentSharp_Fork.WatiN,代码行数:21,代码来源:AttachToFireFoxHelper.cs


注:本文中的WatiN.Core.Constraints.Constraint类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。