• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Constraints.Constraint类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: FindHtmlDialog

		private HtmlDialog FindHtmlDialog(Constraint findBy, int timeout)
		{
			Logger.LogAction("Busy finding HTMLDialog matching criteria: {0}", findBy);

            var action = new TryFuncUntilTimeOut(TimeSpan.FromSeconds(timeout))
            {
                SleepTime = TimeSpan.FromMilliseconds(500)
            };

            var result = action.Try(() => HtmlDialogs.First(findBy));
            
            if (result == null)
            {
                throw new HtmlDialogNotFoundException(findBy.ToString(), timeout);
            }
            
            return result;
		}
开发者ID:fschwiet,项目名称:WatiN-2.0.20.1089-net-2.0,代码行数:18,代码来源:IE.cs


示例17: HtmlDialog

		/// <summary>
		/// Find a HtmlDialog by an attribute within the given <paramref name="timeout" /> period.
		/// Currently Find.ByUrl and Find.ByTitle are supported.
		/// </summary>
		/// <param name="findBy">The url of the html page shown in the dialog</param>
		/// <param name="timeout">Number of seconds before the search times out.</param>
		public HtmlDialog HtmlDialog(Constraint findBy, int timeout)
		{
			return FindHtmlDialog(findBy, timeout);
		}
开发者ID:fschwiet,项目名称:WatiN-2.0.20.1089-net-2.0,代码行数:10,代码来源:IE.cs


示例18: IdHinter

 private IdHinter(Constraint constraint)
 {
     _constraint = constraint ?? Find.Any;
     AsAttributeConstraint = constraint as AttributeConstraint;
 }
开发者ID:fschwiet,项目名称:WatiN-2.0.20.1089-net-2.0,代码行数:5,代码来源:IdHinter.cs


示例19: GetElementIdHint

 /// <summary>
 /// If the constraint can only match on element with a particular id, returns the id,
 /// otherwise returns null.
 /// </summary>
 /// <returns>The id or null if the constraint could match elements with no particular id</returns>
 protected virtual string GetElementIdHint(Constraint constraint)
 {
     return IdHinter.GetIdHint(constraint);
 }
开发者ID:fschwiet,项目名称:WatiN-2.0.20.1089-net-2.0,代码行数:9,代码来源:NativeElementFinder.cs


示例20: FilterImpl

 protected override ElementFinder FilterImpl(Constraint findBy)
 {
     throw new NotImplementedException("Didn't expect filtering on static element");
 }
开发者ID:exaphaser,项目名称:WatiN,代码行数:4,代码来源:StaticElementFinder.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Constraints.ConstraintContext类代码示例发布时间:2022-05-26
下一篇:
C# Core.IE类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap