/// <inheritdoc/>
        protected override void ExecuteInteraction(ElementScope scope)
        {
            ArgumentUtility.CheckNotNull("scope", scope);

            OutputDebugMessage(string.Format("New value: '{0}'", _value));
            scope.FillInWithFixed(_value, _finishInputWithAction);
        }
示例#2
0
        /// <summary>
        /// Focuses a link before actually clicking it.
        /// </summary>
        /// <param name="scope">The <see cref="ElementScope"/> on which the action is performed.</param>
        public static void FocusClick([NotNull] this ElementScope scope)
        {
            ArgumentUtility.CheckNotNull("scope", scope);

            scope.Focus();
            scope.Click();
        }
        public static string GetDocumentation(ElementScope es)
        {
            try
            {
                if (es.declaringUnit == null)
                {
                    return("");
                }
                CodeCompletionTools.XmlDoc xdoc = (CodeCompletionTools.XmlDoc)ht[es.declaringUnit];
                if (xdoc != null)
                {
                    string s = "";
                    switch (es.si.kind)
                    {
                    case SymbolKind.Variable: s = GetNormalHint(xdoc.GetDocumentation("V:" + es.si.name, true)); break;

                    case SymbolKind.Field: s = GetNormalHint(xdoc.GetDocumentation("F:" + es.topScope.si.name + "." + es.si.name, true)); break;

                    case SymbolKind.Property: s = GetNormalHint(xdoc.GetDocumentation("P:" + es.topScope.si.name + "." + es.si.name, true)); break;

                    case SymbolKind.Event: s = GetNormalHint(xdoc.GetDocumentation("E:" + es.topScope.si.name + "." + es.si.name, true)); break;

                    case SymbolKind.Constant: s = GetNormalHint(xdoc.GetDocumentation("C:" + es.si.name, true)); break;
                    }
                    return(s);
                }
            }
            catch (Exception e)
            {
            }
            return("");
        }
示例#4
0
        /// <summary>
        /// Handles <see cref="Attached"/> event
        /// </summary>
        protected override void OnAttached(ElementEventArgs e)
        {
            // Scope will free all allocated child elements
            using (var scope = ElementScope.Create())
            {
                var ctl      = e.Element;
                var children = ctl.Children;
                var got_one  = false;
                for (int i = children.Count - 1; i >= 0; --i)
                {
                    var t = children[i];
                    if (!String.IsNullOrEmpty(t.Attributes["default"]) && !got_one)
                    {
                        t.SetState(ElementState.Current | ElementState.Expanded);
                        got_one = true;
                    }
                    else
                    {
                        t.SetState(ElementState.Collapsed);
                    }
                }
            }

            base.OnAttached(e);
        }
示例#5
0
 public BaselineTab(BrowserSession currentBrowser)
     : base(currentBrowser)
 {
     //browser.FindId("baselinesTab").Click();
     TabBaselines.Click(1);
     element = BaselinesTab.Element;
 }
示例#6
0
        private ElementScope GetParameter(ProcScope func)
        {
            int offset = (int)br.BaseStream.Position - start_pos;

            br.ReadByte();
            string    s  = br.ReadString();
            TypeScope tn = GetTypeReference();
            concrete_parameter_type cpt = (concrete_parameter_type)br.ReadByte();
            ElementScope            p   = new ElementScope(new SymInfo(s, SymbolKind.Parameter, s), tn, null, null);
            bool is_params = br.ReadBoolean();

            if (is_params)
            {
                p.param_kind = parametr_kind.params_parametr;
            }
            else
            {
                switch (cpt)
                {
                case concrete_parameter_type.cpt_const: p.param_kind = parametr_kind.const_parametr; break;

                case concrete_parameter_type.cpt_var: p.param_kind = parametr_kind.var_parametr; break;

                case concrete_parameter_type.cpt_none: p.param_kind = parametr_kind.none; break;
                }
            }
            br.ReadBoolean();
            if (CanReadObject())
            {
                br.ReadInt32(); //CreateExpression();
            }
            br.ReadInt32();     //attributes
            //members[offset] = p;
            return(p);
        }
        private bool ValidateElements(IEnumerable model, ValidationContext validationContext)
        {
            bool          isValid         = true;
            Type          elementType     = GetElementType(model.GetType());
            ModelMetadata elementMetadata = validationContext.MetadataProvider.GetMetadataForType(null, elementType);

            ElementScope elementScope = new ElementScope()
            {
                Index = 0
            };

            validationContext.KeyBuilders.Push(elementScope);

            foreach (object element in model)
            {
                elementMetadata.Model = element;

                if (!this.ValidateNodeAndChildren(elementMetadata, validationContext, model))
                {
                    isValid = false;
                }

                elementScope.Index++;
            }

            validationContext.KeyBuilders.Pop();
            return(isValid);
        }
        /// <summary>
        /// Creates a <see cref="ControlObjectContext"/> for a <see cref="ControlObject"/> which resides on the page.
        /// </summary>
        /// <param name="pageObject">
        /// As the <see cref="PageObjectContext"/> does not know about the <see cref="PageObject"/> it belongs to, the <paramref name="pageObject"/> must
        /// be specified.
        /// </param>
        /// <param name="scope">The scope of the <see cref="ControlObject"/>.</param>
        public ControlObjectContext CloneForControl([NotNull] PageObject pageObject, [NotNull] ElementScope scope)
        {
            ArgumentUtility.CheckNotNull("pageObject", pageObject);
            ArgumentUtility.CheckNotNull("scope", scope);

            return(new ControlObjectContext(pageObject, scope));
        }
示例#9
0
        private bool ValidateMList(ValidationContext validationContext, IMListPrivate mlist)
        {
            bool          isValid         = true;
            Type          elementType     = mlist.GetType().ElementType();
            ModelMetadata elementMetadata = validationContext.MetadataProvider.GetMetadataForType(null, elementType);

            ElementScope elementScope = new ElementScope()
            {
                Index = 0
            };

            validationContext.KeyBuilders.Push(elementScope);

            PropertyScope property = new PropertyScope {
                PropertyName = "element"
            };

            validationContext.KeyBuilders.Push(property);

            foreach (object element in (IEnumerable)mlist)
            {
                elementMetadata.Model = element;
                if (!ValidateNodeAndChildren(elementMetadata, validationContext, mlist))
                {
                    isValid = false;
                }
                elementScope.Index++;
            }
            validationContext.KeyBuilders.Pop();

            validationContext.KeyBuilders.Pop();
            return(isValid);
        }
示例#10
0
文件: Tools.cs 项目: Demser/Autotests
        public static void ClearTextFromField(ElementScope scope)
        {
            var id     = scope.Id;
            var driver = ((RemoteWebDriver)Session.Native);

            driver.FindElementById(id).Clear();
        }
示例#11
0
        /// <summary>
        /// Private constructor, may be obtained via a <see cref="PageObjectContext"/> or via control selection.
        /// </summary>
        internal ControlObjectContext([NotNull] PageObject pageObject, [NotNull] ElementScope scope)
            : base(scope)
        {
            ArgumentUtility.CheckNotNull("pageObject", pageObject);

            _pageObject = pageObject;
        }
        private UnspecifiedPageObject ClickItem(ElementScope itemScope, IWebTestActionOptions actionOptions)
        {
            var itemCommandScope = itemScope.FindLink();
            var itemCommand      = new CommandControlObject(Context.CloneForControl(itemCommandScope));

            return(itemCommand.Click(actionOptions));
        }
示例#13
0
        private UnspecifiedPageObject SwitchTo(ElementScope tabScope, IWebTestActionOptions actionOptions)
        {
            var tabCommandScope = tabScope.FindLink();
            var tabCommand      = new CommandControlObject(Context.CloneForControl(tabCommandScope));

            return(tabCommand.Click(actionOptions));
        }
示例#14
0
 internal HasValueQuery(ElementScope scope, string text, Options options)
 {
     this.elementScope = scope;
     this.text         = text;
     Timeout           = options.Timeout;
     RetryInterval     = options.RetryInterval;
 }
示例#15
0
        /// <summary>
        /// Creates a new context for a given DOM element <paramref name="scope"/>.
        /// </summary>
        protected WebTestObjectContext([NotNull] ElementScope scope)
        {
            ArgumentUtility.CheckNotNull("scope", scope);

            _scope = scope;
            _scope.EnsureExistence();
        }
        /// <summary>
        /// Selects an option of a &lt;select&gt; element by <see cref="DiagnosticMetadataAttributes"/> given by
        /// <paramref name="diagnosticMetadataAttributeName"/> and <paramref name="diagnosticMetadataAttributeValue"/>.
        /// </summary>
        /// <param name="scope">The <see cref="ElementScope"/> on which the action is performed.</param>
        /// <param name="diagnosticMetadataAttributeName">The diagnostic metadata attribute name.</param>
        /// <param name="diagnosticMetadataAttributeValue">The diagnostic metadata attribute value.</param>
        public static void SelectOptionByDMA(
            [NotNull] this ElementScope scope,
            [NotNull] string diagnosticMetadataAttributeName,
            [NotNull] string diagnosticMetadataAttributeValue)
        {
            ArgumentUtility.CheckNotNull("scope", scope);
            ArgumentUtility.CheckNotNullOrEmpty("diagnosticMetadataAttributeName", diagnosticMetadataAttributeName);
            ArgumentUtility.CheckNotNullOrEmpty("diagnosticMetadataAttributeValue", diagnosticMetadataAttributeValue);

            // Hack: Coypu does not yet support SelectElement, use Selenium directly.
            RetryUntilTimeout.Run(
                () =>
            {
                var webElement = (IWebElement)scope.Native;

                var select = new SelectElement(webElement);
                foreach (var option in select.Options)
                {
                    if (option.GetAttribute(diagnosticMetadataAttributeName) != diagnosticMetadataAttributeValue)
                    {
                        continue;
                    }

                    select.SelectByValue(option.GetAttribute("value"));
                    return;
                }

                throw new MissingHtmlException(
                    string.Format(
                        "No option matches the diagnostic metadata '{0}'='{1}'.",
                        diagnosticMetadataAttributeName,
                        diagnosticMetadataAttributeValue));
            });
        }
示例#17
0
        private void BeginElement(XmlElementParser elementParser, XmlElementInfo element)
        {
            ElementScope newScope = new ElementScope(elementParser, element);

            this.currentBranch.Push(newScope);
            this.currentScope = newScope;
        }
        public void ThenICheckThatBatchesWithStatusHadSamlesOnlyWithTestOrOnlyWith(string status, string testName1, string testName2)
        {
            // проверяем, что в каждом бэтче только один тест
            BDMainPage bDMain = new BDMainPage();

            bDMain.OpenBatches();
            IsTrue(bDMain.AssertOpenBatches(), "Что-то пошло не так. не найден заголовок Бэтчи");
            BDBatchesPage bDBatches = new BDBatchesPage();

            bDBatches.WaitSearchButtonClickability();
            // проходим по всем бэтчам в статусе Собран и проверяем, что внутри есть только один из тестов
            int counter = 1;

            foreach (Object i in bDBatches.ListOfBatchesWithThisStatus(status))
            {
                bDBatches.OpenContentOfBatchForAnyStatus(status, counter);
                CommonSteps common = new CommonSteps();
                SecondTab = common.ThenTheTabWithTitleShouldBeOpened("BatchDropper");
                BDContentOfBatchPage bDContent = new BDContentOfBatchPage(SecondTab);
                IsFalse(bDContent.AssertFindSampleWithThisName(testName1)
                        & bDContent.AssertFindSampleWithThisName(testName2), "Что то пошло не так, в бэтче есть тесты с разными программами амплификации");
                Debug.WriteLine($"Проверка бэтча {counter} завершена");
                ++counter;
                bDMain.OpenBatches();
            }
        }
示例#19
0
        private void WriteStartElementAsync_FinishWrite(string prefix, string localName, string ns)
        {
            try
            {
                // push element on stack and add/check namespace
                int top = ++_elemTop;
                if (top == _elemScopeStack.Length)
                {
                    ElementScope[] newStack = new ElementScope[top * 2];
                    Array.Copy(_elemScopeStack, 0, newStack, 0, top);
                    _elemScopeStack = newStack;
                }
                _elemScopeStack[top].Set(prefix, localName, ns, _nsTop);

                PushNamespaceImplicit(prefix, ns);

                if (_attrCount >= MaxAttrDuplWalkCount)
                {
                    _attrHashTable.Clear();
                }
                _attrCount = 0;
            }
            catch
            {
                _currentState = State.Error;
                throw;
            }
        }
示例#20
0
        public ObjectModel(BrowserSession browser, RefType refType, string value, string partial = "", bool more = false)
        // 'partial' & 'more' only used in certain objects, so are optional params
        {
            _browser = browser;
            _partial = partial;
            _more    = more;

            switch (refType)
            {
            case RefType.Id:
                element = _browser.FindId(value, Options.First);
                break;

            case RefType.Xpath:
                element = _browser.FindXPath(value, Options.First);
                break;

            case RefType.Frame:
                element = _browser.FindFrame(value, Options.First);
                break;

            case RefType.Link:
                element = _browser.FindLink(value, Options.First);
                break;

            case RefType.Field:
                element = _browser.FindField(value, Options.First);
                break;

            default:
                throw new MissingHtmlException("RefType entered was not a valid RefType");
            }
        }
        public void ThenAgeIs(string age)
        {
            pageInAnotherTab = Session.FindWindow("Отчет").FindXPath("/html");
            OrderMainPage orderMainPage = new OrderMainPage(pageInAnotherTab);

            Assert.AreEqual(orderMainPage.getFactAge(), age);
            //ScenarioContext.Current.Pending();
        }
示例#22
0
 internal Select(Driver driver, ElementScope selectElement, string optionToSelect, DisambiguationStrategy disambiguationStrategy, Options options)
     : base(driver, selectElement, options)
 {
     this.selectElement          = selectElement;
     this.optionToSelect         = optionToSelect;
     this.options                = options;
     this.disambiguationStrategy = disambiguationStrategy;
 }
示例#23
0
        public void ChooseRadioButtonFromOptions(string radioButton, string options)
        {
            ElementScope _root = root.FindAllCss("div")
                                 .Where(e => e.FindCss("label", text: options).Exists()).First();
            var _rbId = _root.FindCss("label", text: radioButton)["for"];

            root.FindIdEndingWith(_rbId).Check();
        }
        public DefaultStyleInformation([NotNull] ControlObject controlObject, [NotNull] ElementScope styledScope)
        {
            ArgumentUtility.CheckNotNull("controlObject", controlObject);
            ArgumentUtility.CheckNotNull("styledScope", styledScope);

            _controlObject = controlObject;
            _styledScope   = styledScope;
        }
示例#25
0
 internal Select(Driver driver, ElementScope selectElement, string optionToSelect, DisambiguationStrategy disambiguationStrategy, Options options)
     : base(driver, selectElement, options)
 {
     this.selectElement = selectElement;
     this.optionToSelect = optionToSelect;
     this.options = options;
     this.disambiguationStrategy = disambiguationStrategy;
 }
        public void WhenIConfirmRemove()
        {
            pageInAnotherTab = Session.FindWindow("Отчет").FindXPath("/html");
            OrderMainPage orderMainPage = new OrderMainPage(pageInAnotherTab);

            orderMainPage.Confirm();
            //ScenarioContext.Current.Pending();
        }
        public void WhenIDonwloadConclusionsBy(string hxid)
        {
            pageInAnotherTab = Session.FindWindow("Отчет").FindXPath("/html");
            OrderMainPage orderMainPage = new OrderMainPage(pageInAnotherTab);

            orderMainPage.Conclusion_Download(hxid);
            //ScenarioContext.Current.Pending();
        }
        public void WhenIUploadConclusionsByAnd(string hxid, string conclusionFileName)
        {
            pageInAnotherTab = Session.FindWindow("Отчет").FindXPath("/html");
            OrderMainPage orderMainPage = new OrderMainPage(pageInAnotherTab);

            orderMainPage.Conclusion_Upload(hxid, conclusionFileName);
            //ScenarioContext.Current.Pending();
        }
        public void ThenISeeConclusionByInConclusionBlock(string hxid)
        {
            pageInAnotherTab = Session.FindWindow("Отчет").FindXPath("/html");
            OrderMainPage orderMainPage = new OrderMainPage(pageInAnotherTab);

            Assert.IsTrue(orderMainPage.ConclusionExist(hxid));
            //ScenarioContext.Current.Pending();
        }
        protected WebTestAction([NotNull] ControlObject control, [NotNull] ElementScope scope)
        {
            ArgumentUtility.CheckNotNull("control", control);
            ArgumentUtility.CheckNotNull("scope", scope);

            _control = control;
            _scope   = scope;
        }
        public void ThenISeeRemoveConfirmDialog()
        {
            pageInAnotherTab = Session.FindWindow("Отчет").FindXPath("/html");
            OrderMainPage orderMainPage = new OrderMainPage(pageInAnotherTab);

            Assert.IsTrue(orderMainPage.ConclusionRemoveConfirmDialogTitleExist());
            //ScenarioContext.Current.Pending();
        }
示例#32
0
文件: FillIn.cs 项目: MatteS75/coypu
 internal FillIn(Driver driver, ElementScope element, string value, Options options)
     : this(driver,null,null,value,options)
 {
     this.element = element;
 }
示例#33
0
 internal Choose(Driver driver, ElementScope elementScope, Options options)
     : base(driver, elementScope, options)
 {
     this.elementScope = elementScope;
 }
        private bool ValidateElements(IEnumerable model, ValidationContext validationContext)
        {
            bool isValid = true;
            Type elementType = GetElementType(model.GetType());
            ModelMetadata elementMetadata = validationContext.MetadataProvider.GetMetadataForType(null, elementType);

            ElementScope elementScope = new ElementScope() { Index = 0 };
            validationContext.KeyBuilders.Push(elementScope);
            foreach (object element in model)
            {
                elementMetadata.Model = element;
                if (!ValidateNodeAndChildren(elementMetadata, validationContext, model))
                {
                    isValid = false;
                }
                elementScope.Index++;
            }
            validationContext.KeyBuilders.Pop();
            return isValid;
        }
示例#35
0
 internal Uncheck(Driver driver, ElementScope element, Options options) 
     : base(driver, options)
 {
     this.element = element;
 }
示例#36
0
 internal ClickAction(ElementScope elementScope, Driver driver, Options options)
     : base(driver, elementScope, options)
 {
     this.elementScope = elementScope;
 }
示例#37
0
 internal FillIn(Driver driver, ElementScope element, string value, Options options) : base(driver, element, options)
 {
     this.element = element;
     this.value = value;
 }
示例#38
0
 internal FillIn(Driver driver, DriverScope scope, string locator, ElementScope element, string value, bool forceAllEvents, Options options)
     : this(driver,scope,locator,element.Now(),value,forceAllEvents,options)
 {
 }
        private bool ValidateMList(ValidationContext validationContext, IMListPrivate mlist)
        {
            bool isValid = true;
            Type elementType = mlist.GetType().ElementType();
            ModelMetadata elementMetadata = validationContext.MetadataProvider.GetMetadataForType(null, elementType);

            ElementScope elementScope = new ElementScope() { Index = 0 };
            validationContext.KeyBuilders.Push(elementScope);

            PropertyScope property = new PropertyScope { PropertyName = "element" };
            validationContext.KeyBuilders.Push(property);

            foreach (object element in (IEnumerable)mlist)
            {
                elementMetadata.Model = element;
                if (!ValidateNodeAndChildren(elementMetadata, validationContext, mlist))
                {
                    isValid = false;
                }
                elementScope.Index++;
            }
            validationContext.KeyBuilders.Pop();

            validationContext.KeyBuilders.Pop();
            return isValid;
        }
        private bool ValidateElements(IEnumerable model, ValidationContext validationContext)
        {
            bool isValid = true;
            Type elementType = GetElementType(model.GetType());
            ModelMetadata elementMetadata = validationContext.MetadataProvider.GetMetadataForType(null, elementType);

            ElementScope elementScope = new ElementScope() { Index = 0 };
            validationContext.KeyBuilders.Push(elementScope);
            IEnumerable<ModelValidator> validators = validationContext.ActionContext.GetValidators(elementMetadata, validationContext.ValidatorCache);

            // if there are no validators or the object is null we bail out quickly
            // when there are large arrays of null, this will save a significant amount of processing
            // with minimal impact to other scenarios.
            bool anyValidatorsDefined = validators.Any();

            foreach (object element in model)
            {
                // If the element is non null, the recursive calls might find more validators.
                // If it's null, then a shallow validation will be performed.
                if (element != null || anyValidatorsDefined)
                {
                    elementMetadata.Model = element;

                    if (!ValidateNodeAndChildren(elementMetadata, validationContext, model, validators))
                    {
                        isValid = false;
                    }
                }

                elementScope.Index++;
            }
            validationContext.KeyBuilders.Pop();
            return isValid;
        }
        public override void WriteStartElement(string prefix, string localName, string ns) {
            try {
                // check local name
                if (localName == null || localName.Length == 0) {
                    throw new ArgumentException(Res.GetString(Res.Xml_EmptyLocalName));
                }
                CheckNCName(localName);

                AdvanceState(Token.StartElement);

                // lookup prefix / namespace  
                if (prefix == null) {
                    if (ns != null) {
                        prefix = LookupPrefix(ns);
                    }
                    if (prefix == null) {
                        prefix = string.Empty;
                    }
                }
                else if (prefix.Length > 0) {
                    CheckNCName(prefix);
                    if (ns == null) {
                        ns = LookupNamespace(prefix);
                    }
                    if (ns == null || (ns != null && ns.Length == 0)) {
                        throw new ArgumentException(Res.GetString(Res.Xml_PrefixForEmptyNs));
                    }
                }
                if (ns == null) {
                    ns = LookupNamespace(prefix);
                    if (ns == null) {
                        Debug.Assert(prefix.Length == 0);
                        ns = string.Empty;
                    }
                }

                // write start tag
                writer.WriteStartElement(prefix, localName, ns);

                // push element on stack and add/check namespace
                int top = ++elemTop;
                if (top == elemScopeStack.Length) {
                    ElementScope[] newStack = new ElementScope[top * 2];
                    Array.Copy(elemScopeStack, newStack, top);
                    elemScopeStack = newStack;
                }
                elemScopeStack[top].Set(prefix, localName, ns, nsTop);

                PushNamespace(prefix, ns, false);

                if (attrCount >= MaxAttrDuplWalkCount) {
                    attrHashTable.Clear();
                }
                attrCount = 0;

            }
            catch {
                currentState = State.Error;
                throw;
            }
        }
示例#42
0
 internal CheckAction(Driver driver, ElementScope element, Options options)
     : base(driver, element, options)
 {
     this.element = element;
 }
 public override void WriteStartElement(string prefix, string localName, string ns)
 {
     try
     {
         if ((localName == null) || (localName.Length == 0))
         {
             throw new ArgumentException(Res.GetString("Xml_EmptyLocalName"));
         }
         this.CheckNCName(localName);
         this.AdvanceState(Token.StartElement);
         if (prefix == null)
         {
             if (ns != null)
             {
                 prefix = this.LookupPrefix(ns);
             }
             if (prefix == null)
             {
                 prefix = string.Empty;
             }
         }
         else if (prefix.Length > 0)
         {
             this.CheckNCName(prefix);
             if (ns == null)
             {
                 ns = this.LookupNamespace(prefix);
             }
             if ((ns == null) || ((ns != null) && (ns.Length == 0)))
             {
                 throw new ArgumentException(Res.GetString("Xml_PrefixForEmptyNs"));
             }
         }
         if (ns == null)
         {
             ns = this.LookupNamespace(prefix);
             if (ns == null)
             {
                 ns = string.Empty;
             }
         }
         if ((this.elemTop == 0) && (this.rawWriter != null))
         {
             this.rawWriter.OnRootElement(this.conformanceLevel);
         }
         this.writer.WriteStartElement(prefix, localName, ns);
         int length = ++this.elemTop;
         if (length == this.elemScopeStack.Length)
         {
             ElementScope[] destinationArray = new ElementScope[length * 2];
             Array.Copy(this.elemScopeStack, destinationArray, length);
             this.elemScopeStack = destinationArray;
         }
         this.elemScopeStack[length].Set(prefix, localName, ns, this.nsTop);
         this.PushNamespaceImplicit(prefix, ns);
         if (this.attrCount >= 14)
         {
             this.attrHashTable.Clear();
         }
         this.attrCount = 0;
     }
     catch
     {
         this.currentState = State.Error;
         throw;
     }
 }
	// Push a new element scope.
	private void PushScope(String prefix, String localName, bool scopeShown, String xmlns)
			{
				scope = new ElementScope(scope);
				scope.prefix = (prefix != null ? nameTable.Add(prefix) : null);
				scope.localName =
					(localName != null ? nameTable.Add(localName) : null);
				scope.xmlns = (xmlns != null ? nameTable.Add(xmlns) : null);
				scope.scopeShown = scopeShown;
				scope.indentLevel = indentLevel;
				if(formatting == System.Xml.Formatting.Indented)
				{
					indentLevel++;
				}
				scope.indent = false;
				scope.xmlSpace = xmlSpace;
				scope.xmlLang = xmlLang;
				scope.genPrefixCount = 0;
				namespaceManager.PushScope();
			}
示例#45
0
 public override void Act()
 {
     selectElement = selectElement ?? FindSelectElement();
     SelectOption(selectElement);
 }
示例#46
0
 void SelectOption(ElementScope selectElementScope)
 {
     var option = disambiguationStrategy.ResolveQuery(new OptionFinder(Driver, optionToSelect, selectElementScope, options));
     Driver.Click(option);
 }
		public int genPrefixCount;      // The count of generated prefixes.
		public ElementScope(ElementScope next)
				{
					this.next = next;
				}
        public override void WriteStartElement(string prefix, string localName, string ns)
        {
            try
            {
                // check local name
                if (localName == null || localName.Length == 0)
                {
                    throw new ArgumentException(SR.Xml_EmptyLocalName);
                }
                CheckNCName(localName);

                AdvanceState(Token.StartElement);

                // lookup prefix / namespace  
                if (prefix == null)
                {
                    if (ns != null)
                    {
                        prefix = LookupPrefix(ns);
                    }
                    if (prefix == null)
                    {
                        prefix = string.Empty;
                    }
                }
                else if (prefix.Length > 0)
                {
                    CheckNCName(prefix);
                    if (ns == null)
                    {
                        ns = LookupNamespace(prefix);
                    }
                    if (ns == null || (ns != null && ns.Length == 0))
                    {
                        throw new ArgumentException(SR.Xml_PrefixForEmptyNs);
                    }
                }
                if (ns == null)
                {
                    ns = LookupNamespace(prefix);
                    if (ns == null)
                    {
                        Debug.Assert(prefix.Length == 0);
                        ns = string.Empty;
                    }
                }

                if (_elemTop == 0 && _rawWriter != null)
                {
                    // notify the underlying raw writer about the root level element
                    _rawWriter.OnRootElement(_conformanceLevel);
                }

                // write start tag
                _writer.WriteStartElement(prefix, localName, ns);

                // push element on stack and add/check namespace
                int top = ++_elemTop;
                if (top == _elemScopeStack.Length)
                {
                    ElementScope[] newStack = new ElementScope[top * 2];
                    Array.Copy(_elemScopeStack, 0, newStack, 0, top);
                    _elemScopeStack = newStack;
                }
                _elemScopeStack[top].Set(prefix, localName, ns, _nsTop);

                PushNamespaceImplicit(prefix, ns);

                if (_attrCount >= MaxAttrDuplWalkCount)
                {
                    _attrHashTable.Clear();
                }
                _attrCount = 0;
            }
            catch
            {
                _currentState = State.Error;
                throw;
            }
        }
        private void WriteStartElementAsync_FinishWrite(string prefix, string localName, string ns) {
            try {
                // push element on stack and add/check namespace
                int top = ++elemTop;
                if (top == elemScopeStack.Length) {
                    ElementScope[] newStack = new ElementScope[top * 2];
                    Array.Copy(elemScopeStack, newStack, top);
                    elemScopeStack = newStack;
                }
                elemScopeStack[top].Set(prefix, localName, ns, nsTop);

                PushNamespaceImplicit(prefix, ns);

                if (attrCount >= MaxAttrDuplWalkCount) {
                    attrHashTable.Clear();
                }
                attrCount = 0;
            }
            catch {
                currentState = State.Error;
                throw;
            }
        }
	// Pop the current element scope.
	private void PopScope()
			{
				indentLevel = scope.indentLevel;
				xmlSpace = scope.xmlSpace;
				xmlLang = scope.xmlLang;
				scope = scope.next;
				namespaceManager.PopScope();
			}
	// Initialize the common writer fields.
	private void Initialize()
			{
				namespaces = true;
				needPrefixDecl = false;
				indentation = 2;
				indentLevel = 0;
				indentChar = ' ';
				quoteChar = '"';
				indentChars = new char[indentation];
				scope = null;
				formatting = System.Xml.Formatting.None;
				special = Special.None;
				specialWriter = new SpecialWriter(writer);
				nsPrefix = null;
				xmlLang = null;
				writeState = System.Xml.WriteState.Start;
				nameTable = new NameTable();
				namespaceManager = new XmlNamespaceManager(nameTable);
				xmlSpace = XmlSpace.None;
				autoShiftToContent = false;
				for(int i = 0; i < indentation; i++)
				{
					indentChars[i] = indentChar;
				}
			}