public string CheckSettingSubscription() { WebElement ssub = new WebElement().ByXPath("//a[contains(@class,'ui-commandlink ui-widget settings false')]"); if (!ssub.Displayed) { return("Отсутствуют параметризованные подписки"); } ssub.Click(); Thread.Sleep(20000); if (!new WebElement().ByXPath("//label[contains(text(),'Запрет доступа ко всем платным и бесплатным SMS-сервисам Провайдеров, а также получения сообщений от банков и торговых точек')]").Displayed) { return("Не отображается настройка Запрет доступа ко всем платным и бесплатным SMS-сервисам Провайдеров..."); } if (!new WebElement().ByXPath("//label[text()='Запрет доступа к SMS-сервисам Провайдеров стоимостью более 50-ти руб. с НДС']").Displayed) { return("Не отображается настройка Запрет доступа к SMS-сервисам Провайдеров стоимостью более 50-ти руб. с НДС"); } if (!new WebElement().ByXPath("//label[text()='Запрет доступа ко всем платным SMS-сервисам Провайдеров, но остается возможность получать сообщения от банков и торговых сетей']").Displayed) { return("Не отображается настройка Запрет доступа ко всем платным SMS-сервисам Провайдеров, но остается возможность получать сообщения от банков и торговых сетей"); } WebElement rb = new WebElement().ByXPath("//div[@class='ui-radiobutton-box ui-widget ui-corner-all ui-state-default']//span"); if (!rb.Displayed) { return("Отсутствует радиобаттон"); } rb.Click(); Thread.Sleep(10000); WebElement btnSuccess = new WebElement().ByXPath("//button[contains(@id,'connectorBtn')]"); if (!btnSuccess.Displayed) { return("Отсутствует кнопка Изменить"); } btnSuccess.Click(); Thread.Sleep(20000); string mb = new WebElement().ByXPath("//div[@class='ui-outputpanel ui-widget connectorResults message']").Text; if (!mb.Contains("Запрос") | !mb.Contains("на подключение услуги") | !mb.Contains(" успешно отправлен. За статусом запроса следите в")) { return("Текст сообщения неверен"); } return("success"); }
public string ViewNewTariff(string nameTariff) { try { nameTariff = nameTariff.Replace(" ", ""); var text = new WebElement().ByXPath("//div[@id='" + nameTariff + "']/div[1]/div[2]/div/div").Text; //string text = teext.Text; if (text.Contains("Тарифный план будет изменен с") & text.Contains("текущий тариф будет отключен автоматически.")) { return("success"); } else { return("Текст не верен"); } } catch (Exception e) { return(e.Message); } }
public string ReadMassageTariff() { WebElement btn = new WebElement().ByXPath( "//div[contains(@class,'service-item tariff-item')][1]//button[contains(@id,'changeButton')]"); string text = new WebElement().ByXPath( "//div[contains(@class,'service-item tariff-item')][1]//div[@class='payment-ways']") .Text; if ( text.Contains( "К сожалению, средств на вашем счёте недостаточно. Вы можете пополнить баланс с помощью услуги") && !btn.Enabled) { return("success"); } return("Текст не корректен"); }
public string CheckTariffChangeRequest(string old_soc, string new_soc) { string New_tariffWE = new WebElement().ByXPath("//form[@id='j_idt311']/div[1]/div[2]/div/div[1]/div[2]/div[2]/div[2]").Text; string Old_tariffWE = new WebElement().ByXPath("//tbody[@id='j_idt311:massRequestTable_data']/tr/td[2]").Text; WebElement date = new WebElement().ByXPath("//form[@id='j_idt311']/div[1]/div[2]/div/div[1]/div[1]/div[5]/div[2]"); var new_ent_name = Executor.ExecuteSelect("select entity_name from web_entity where ext_entity_code = '" + new_soc.Replace(" ", "") + "'"); var old_ent_name = Executor.ExecuteSelect("select entity_name from web_entity where ext_entity_code = '" + old_soc.Replace(" ", "") + "'"); if (!New_tariffWE.Contains(new_ent_name[0, 0])) { return("Не отображена информация о новом тарифе"); } if (!Old_tariffWE.Contains(old_ent_name[0, 0])) { return("Не отобрадена информация о старом тарифе"); } if (!date.Displayed) { return("Не отображена дата"); } return("success"); }
public string SuccessChangeOfTariff(ref string nameTariff, ref string number, string ban, string db_Ans) { try { if (nameTariff == null) { nameTariff = new WebElement().ByXPath("//div[contains(@id,'tariffsList')]//div[contains(@class,'service-item tariff-item')][1]//div[@class='info ']").Id; WebElement tar = new WebElement().ByXPath("//div[contains(@class,'service-item tariff-item')][1]//button[contains(@id,'changeButton')]"); //Заявка №2 147 510 530 на изменение тарифа if (tar.Displayed) { if (tar.Enabled) { SaveSF(ban, db_Ans, nameTariff); tar.Click(); Thread.Sleep(10000); WebElement relsocbutton = new WebElement().ByXPath("//button[contains(@id,'relatedSocsComponent')]"); if (relsocbutton.Displayed) { relsocbutton.Click(); } string text = new WebElement().ByXPath( "//div[contains(@class,'service-item tariff-item')][1]//div[contains(@class,'info')]//div[@class='message message-success']") .Text; if (text.Contains("Заявка") && text.Contains("на изменение тарифа") && text.Contains("принята, за статусом можно следить в") && text.Contains("истории заявок")) { number = text.Remove(0, text.IndexOf('№') + 1); number = number.Remove(number.IndexOf(" на изменение"), number.Length - number.IndexOf(" на изменение")); while (number.IndexOf(' ') != -1) { number = number.Remove(number.IndexOf(' '), 1); } return("success"); } else { return("Текст не верен"); } } return("Кнопка заблокирована"); } return("Кнопка не отображена"); } else { WebElement tar = new WebElement().ByXPath("//div[contains(@id," + nameTariff + ")]//ancestor::div[1]//button[contains(@id,'changeButton')]"); //Заявка №2 147 510 530 на изменение тарифа if (tar.Displayed) { if (tar.Enabled) { SaveSF(ban, db_Ans, nameTariff); tar.Click(); string text = new WebElement().ByXPath( "//div[contains(@id," + nameTariff + ")]//ancestor::div[1]//div[contains(@class,'info')]//div[@class='message message-success']") .Text; if (text.Contains("Заявка") && text.Contains("на изменение тарифа") && text.Contains("принята, за статусом можно следить в") && text.Contains("истории заявок")) { number = text.Remove(0, text.IndexOf('№') + 1); number = number.Remove(number.IndexOf(" на изменение"), number.Length - number.IndexOf(" на изменение")); while (number.IndexOf(' ') != -1) { number = number.Remove(number.IndexOf(' '), 1); } return("success"); } else { return("Текст не верен"); } } return("Кнопка заблокирована"); } return("Кнопка не отображена"); } } catch (Exception e) { return(e.Message); } }
public string SuccessDisconnectOfService(ref string nameService, ref string number, string db_Ans) { Thread.Sleep(5000); try { if (nameService == null) { var t = "select logical_date from logical_date@" + db_Ans + @" where rownum<2"; var tm = Executor.ExecuteSelect(t); string dateB = Convert.ToDateTime(tm[0, 0]).ToShortDateString(); var d = dateB.Split('.'); string date = d[0] + "." + d[1] + "." + d[2].Remove(0, 2); WebElement endDate = new WebElement().ByXPath("//div[contains(@class,'service-item')][1]//span[contains(@id,'disconnectingSocDate')]//input"); WebElement btnCancel = new WebElement().ByXPath("//div[contains(@class,'service-item')][1]//a[contains(text(),'Не отключать')]"); if (!endDate.Displayed) { return("Не отображается поле ввода даты отключения"); } if (endDate.Value != date) { return("Дата отключения по умолчанию некорректна"); } if (!btnCancel.Displayed) { return("Не отображается псевдоссылка отмены подключения услуги"); } WebElement btnChange = new WebElement().ByXPath("//div[contains(@class,'service-item')][1]//button[contains(@id,'dscntBtn')]"); if (btnChange.Displayed) { if (btnChange.Enabled) { btnChange.Click(); } else { return("Кнопка подтверждения подключения заблокирована"); } } else { return("Кнопка подтверждения смены услуги не отображается"); } nameService = new WebElement().ByXPath("//div[contains(@class,'service-item')][1]").Id; string text = new WebElement().ByXPath( "//div[contains(@class,'service-item')][1]//div[@class='ui-outputpanel ui-widget disconnectorResults message']") .Text; // Запрос 2147677532 на отключение услуги "GPRS-пакет в международном роуминге 100 Мб" успешно отправлен. За статусом запроса следите вистории заявок if (text.Contains("Запрос") && text.Contains("на отключение услуги") && text.Contains("успешно отправлен. За статусом запроса следите в") && text.Contains("истории заявок")) { number = text.Remove(0, text.IndexOf(' ') + 1); number = number.Remove(number.IndexOf(" на отключение"), number.Length - number.IndexOf(" на отключение")); while (number.IndexOf(' ') != -1) { number = number.Remove(number.IndexOf(' '), 1); } return("success"); } else { return("Текст не верен"); } } return("success"); } catch (Exception e) { return(e.Message); } }
public string SuccessChangeOfTariff(ref string nameTariff, ref string number) { try { number = "0"; if (nameTariff == null) { WebElement btnChange = new WebElement().ByXPath( "//div[contains(@class,'service-item tariff-item')][1]//button[contains(@id,'changeButton')]"); if (btnChange.Displayed) { if (btnChange.Enabled) { btnChange.Click(); } else { return("Кнопка подтверждения смены тарифа заблокирована"); } } else { return("Кнопка подтверждения смены тарифа не отображается"); } Thread.Sleep(10000); WebElement relsocbutton = new WebElement().ByXPath("//button[contains(@id,'relatedSocsComponent')]"); if (relsocbutton.Displayed) { relsocbutton.Click(); } nameTariff = new WebElement().ByXPath("//div[contains(@class,'service-item tariff-item')][1]//div[@class='info ']").Id; string text = new WebElement().ByXPath( "//div[contains(@class,'service-item tariff-item')][1]//div[@class='info ']//div[@class='message message-success']") .Text; if (text.Contains("Заявка") && text.Contains("на изменение тарифа") && text.Contains("принята, за статусом можно следить в") && text.Contains("истории заявок")) { number = text.Remove(0, text.IndexOf('№') + 1); number = number.Remove(number.IndexOf(" на изменение"), number.Length - number.IndexOf(" на изменение")); while (number.IndexOf(' ') != -1) { number = number.Remove(number.IndexOf(' '), 1); } return("success"); } else { return("Текст не верен"); } } else { WebElement btnChange = new WebElement().ByXPath( "//div[contains(@id," + nameTariff + ")]//ancestor::div[1]//button[contains(@id,'changeButton')]"); if (btnChange.Displayed) { if (btnChange.Enabled) { btnChange.Click(); } else { return("Кнопка подтверждения смены тарифа заблокирована"); } } else { return("Кнопка подтверждения смены тарифа не отображается"); } string text = new WebElement().ByXPath( "//div[contains(@id," + nameTariff + ")]//ancestor::div[1]//div[@class='info ']//div[@class='message message-success']") .Text; if (text.Contains("Заявка") && text.Contains("на изменение тарифа") && text.Contains("принята, за статусом можно следить в") && text.Contains("истории заявок")) { number = text.Remove(0, text.IndexOf('№') + 1); number = number.Remove(number.IndexOf(" на изменение"), number.Length - number.IndexOf(" на изменение")); while (number.IndexOf(' ') != -1) { number = number.Remove(number.IndexOf(' '), 1); } return("success"); } else { return("Текст не верен"); } } } catch (Exception e) { return(e.Message); } }