Exemplo n.º 1
0
 /// <summary>
 /// Нажимает кнопку на сайте в элементе
 /// </summary>
 /// <param name="webControl">webControl на котором будет выполнять метод</param>
 /// <param name="getElementBy">Атрибут поиска в теге</param>
 /// <param name="ElementValue">Значение атрибута, по которому будет происходить поиск</param>
 public void PressButtonInDIV(WebControl webControl, GetElementBy getElementBy, string ElementValue, int count, GetElementBy getElementBy2, string ElementValue2, int count2, string type)
 {
     if (getElementBy == GetElementBy.Id)
     {
         if (getElementBy2 == GetElementBy.Id)
         {
             webControl.ExecuteJavascript("document." + Elements[getElementBy] + "('" + ElementValue + "')." + Elements[getElementBy2] + "('" + ElementValue2 + "')." + type + "()");
         }
         else
         {
             webControl.ExecuteJavascript("document." + Elements[getElementBy] + "('" + ElementValue + "')." + Elements[getElementBy2] + "('" + ElementValue2 + "')[" + count2 + "]." + type + "()");
         }
     }
     else
     {
         if (getElementBy2 == GetElementBy.Id)
         {
             webControl.ExecuteJavascript("document." + Elements[getElementBy] + "('" + ElementValue + "')[" + count + "]." + Elements[getElementBy2] + "('" + ElementValue2 + "')." + type + "()");
         }
         else
         {
             webControl.ExecuteJavascript("document." + Elements[getElementBy] + "('" + ElementValue + "')[" + count + "]." + Elements[getElementBy2] + "('" + ElementValue2 + "')[" + count2 + "]." + type + "()");
         }
     }
 }
Exemplo n.º 2
0
        public string GetAtribInDivInDiv(WebControl webControl, GetElementBy getElementBy, string Atrribute, int count, GetElementBy getElementBy2, string Atrribute2, int count2, string Atrrib)
        {
            string js_code;

            if (getElementBy == GetElementBy.Id)
            {
                if (getElementBy2 == GetElementBy.Id)
                {
                    js_code = "document." + Elements[getElementBy] + "('" + Atrribute + "')." + Elements[getElementBy2] + "('" + Atrribute2 + "')." + Atrrib;
                }
                else
                {
                    js_code = "document." + Elements[getElementBy] + "('" + Atrribute + "')." + Elements[getElementBy2] + "('" + Atrribute2 + "')[" + count2 + "]." + Atrrib;
                }
            }
            else
            {
                if (getElementBy2 == GetElementBy.Id)
                {
                    js_code = "document." + Elements[getElementBy] + "('" + Atrribute + "')[" + count + "]." + Elements[getElementBy2] + "('" + Atrribute2 + "')." + Atrrib;
                }
                else
                {
                    js_code = "document." + Elements[getElementBy] + "('" + Atrribute + "')[" + count + "]." + Elements[getElementBy2] + "('" + Atrribute2 + "')[" + count2 + "]." + Atrrib;
                }
            }
            return(webControl.ExecuteJavascriptWithResult(js_code));
            // return js_code;
        }
Exemplo n.º 3
0
        public void WriteInFieldInDiv(WebControl webControl, GetElementBy getElementBy, string AttributeValue, int count, GetElementBy getElementBy2, string AttributeValue2, int count2, string value)
        {
            string js_code;

            if (getElementBy == GetElementBy.Id)
            {
                if (getElementBy2 == GetElementBy.Id)
                {
                    js_code = "document." + Elements[getElementBy] + "('" + AttributeValue + "')." + Elements[getElementBy2] + "('" + AttributeValue2 + "').value = " + "'" + value + "'";
                }
                else
                {
                    js_code = "document." + Elements[getElementBy] + "('" + AttributeValue + "')." + Elements[getElementBy2] + "('" + AttributeValue2 + "')[" + count2 + "].value = " + "'" + value + "'";
                }
            }
            else
            {
                if (getElementBy2 == GetElementBy.Id)
                {
                    js_code = "document." + Elements[getElementBy] + "('" + AttributeValue + "')[" + count + "]." + Elements[getElementBy2] + "('" + AttributeValue2 + "').value = " + "'" + value + "'";
                }
                else
                {
                    js_code = "document." + Elements[getElementBy] + "('" + AttributeValue + "')[" + count + "]." + Elements[getElementBy2] + "('" + AttributeValue2 + "')[" + count2 + "].value = " + "'" + value + "'";
                }
            }
            webControl.ExecuteJavascript(js_code);
        }
Exemplo n.º 4
0
 /// <summary>
 /// Записывает в поле на сайта
 /// </summary>
 /// <param name="webControl">webControl на котором будет выполнять метод</param>
 /// <param name="getElementBy">Атрибут поиска в теге</param>
 /// <param name="AttributeValue">Значение атрибута, по которому происходит поиск элемента</param>
 /// <param name="value">Значение, которое запишет в поле на сайте</param>
 public void WriteInField(WebControl webControl, GetElementBy getElementBy, string AttributeValue, string value)
 {
     if (getElementBy == GetElementBy.Id)
     {
         webControl.ExecuteJavascript("document." + Elements[getElementBy] + "('" + AttributeValue + "').value = " + "'" + value + "'");
     }
     else
     {
         webControl.ExecuteJavascript("document." + Elements[getElementBy] + "('" + AttributeValue + "')[0].value = " + "'" + value + "'");
     }
 }
Exemplo n.º 5
0
        internal void HideDiv(WebControl webControl, GetElementBy getElementBy, string Atrribute, int count, string display)
        {
            string js_code;

            if (getElementBy == GetElementBy.Id)
            {
                js_code = "document." + Elements[getElementBy] + "('" + Atrribute + "').setAttribute('style','display:" + display + ";');";
            }
            else
            {
                if (count == -1)//все элементы скрыть
                {
                    js_code = "var appBanners = document." + Elements[getElementBy] + "('" + Atrribute + "'), i; for (var i = 0; i < appBanners.length; i ++) { appBanners[i].setAttribute('style','display:" + display + ";');}";
                }
                else
                {
                    js_code = "document." + Elements[getElementBy] + "('" + Atrribute + "')[" + count + "].setAttribute('style','display:" + display + ";');";
                }
            }

            webControl.ExecuteJavascriptWithResult(js_code);
        }
Exemplo n.º 6
0
 /// <summary>
 /// Выбирает значение из comboBox на сайте
 /// </summary>
 /// <param name="webControl">webControl на котором будет выполнять метод</param>
 /// <param name="getElementBy">Атрибут поиска в теге</param>
 /// <param name="nuberComboBoxValue">Индекс, по которому выберет значение из comboBox</param>
 public void SelectComboBoxValue(WebControl webControl, GetElementBy getElementBy, string ElementValue, int nuberComboBoxValue)
 {
     webControl.ExecuteJavascript("document." + Elements[getElementBy] + "('" + ElementValue + "').selectedIndex = " + nuberComboBoxValue);
 }
Exemplo n.º 7
0
 /// <summary>
 /// Нажимает кнопку на сайте
 /// </summary>
 /// <param name="webControl">webControl на котором будет выполнять метод</param>
 /// <param name="getElementBy">Атрибут поиска в теге</param>
 /// <param name="ElementValue">Значение атрибута, по которому будет происходить поиск</param>
 public void PressButton(WebControl webControl, GetElementBy getElementBy, string ElementValue)
 {
     webControl.ExecuteJavascript("document." + Elements[getElementBy] + "('" + ElementValue + "')[0].click()");
 }
Exemplo n.º 8
0
 internal void WriteInField(WebControl webControl, GetElementBy id, string v)
 {
     throw new NotImplementedException();
 }