Exemplo n.º 1
0
 /// <summary>
 /// Подстановка параметра в условие поля
 /// </summary>
 /// <param name="fullPathParameter">Полный индекс условия</param>
 /// <param name="parameter">Параметр</param>
 public void SendParameter(string fullPathParameter, string parameter)
 {
     if (FindFirstElement(fullPathParameter, null, true) == null)
     {
         return;
     }
     FindFirstElement("Name:Значение", FindElement, true);
     FindElement.SetFocus();
     SendKeys.SendWait("{ENTER}");
     SendKeys.SendWait(parameter);
 }
Exemplo n.º 2
0
        /// <summary>
        /// Паттерн прокрутки до элемента нажатия
        /// </summary>
        /// <param name="nameAutomationId"></param>
        public void ScrollPatternViewElement(string nameAutomationId)
        {
            var isProcess = true;

            while (isProcess)
            {
                if (IsEnableElements(nameAutomationId, null, false, 5) != null)
                {
                    FindElement.SetFocus();
                    if (FindElement.TryGetCurrentPattern(ScrollItemPatternIdentifiers.Pattern, out var patternObj))
                    {
                        var valuePattern = (ScrollItemPattern)patternObj;
                        valuePattern.ScrollIntoView();
                        isProcess = false;
                    }
                }
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Контроль даты календаря который нелзя спарсить
        /// </summary>
        /// <param name="dateTime">Дата и время которое надо подставить</param>
        public void DateControlComboboxNotValue(DateTime dateTime)
        {
            var yearAutomation = Convert.ToInt32(FindElement.Current.Name.Split(' ')[2].Trim());
            var yearControl    = dateTime.Year;

            while (yearAutomation != yearControl)
            {
                FindElement.SetFocus();
                ClickElement(FindElement, -110, 0);
                AutoItX.Send(yearAutomation > yearControl
                             ? string.Format(ButtonConstant.DownCountClick, 1)
                             : string.Format(ButtonConstant.UpCountClick, 1));
                AutoItX.Sleep(100);
                yearAutomation = Convert.ToInt32(FindElement.Current.Name.Split(' ')[2].Trim());
            }

            var mouthAutomation = FindElement.Current.Name.Split(' ')[1].Trim();
            var mouthControl    = Calendar.FirstOrDefault(x => x.Key == dateTime.Month).Value;

            while (mouthAutomation != mouthControl)
            {
                ClickElement(FindElement, -165);
                AutoItX.Send(string.Format(ButtonConstant.UpCountClick, 1));
                AutoItX.Sleep(100);
                mouthAutomation = FindElement.Current.Name.Split(' ')[1].Trim();
            }

            var dayAutomation = Convert.ToInt32(FindElement.Current.Name.Split(' ')[0].Trim());
            var dayControl    = dateTime.Day;

            while (dayAutomation != dayControl)
            {
                FindElement.SetFocus();
                ClickElement(FindElement, -180);
                AutoItX.Send(string.Format(ButtonConstant.UpCountClick, 1));
                AutoItX.Sleep(100);
                dayAutomation = Convert.ToInt32(FindElement.Current.Name.Split(' ')[0].Trim());
            }
        }