Esempio n. 1
0
        public void YandexTextSearch()
        {
            String emptySearchResponse = "Задан пустой поисковый запрос";

            Selene.GoToUrl("https://yandex.ru/search");
            Selene.S(With.Text(emptySearchResponse)).Should(Have.Text(emptySearchResponse));
        }
Esempio n. 2
0
 public static void Visit()
 {
     Selene.GoToUrl("https://todomvc4tasj.herokuapp.com/");
     Selene.WaitFor(Selene.GetWebDriver(), Have.JSReturnedTrue(
                        "return " +
                        "$._data($('#new-todo').get(0), 'events').hasOwnProperty('keyup')&& " +
                        "$._data($('#toggle-all').get(0), 'events').hasOwnProperty('change') && " +
                        "$._data($('#clear-completed').get(0), 'events').hasOwnProperty('click')"));
 }
        public void GoogleSearchText()
        {
            string url = "http://google.com";

            Selene.GoToUrl(url);
            SeleneElement searchInput = Selene.S("#lst-ib");

            searchInput.SetValue("QA");
        }
Esempio n. 4
0
        public void MultilineTextSearchIntegrationTest()
        {
            String url         = "http://www.rfbr.ru/rffi/ru/";
            String cssSelector = "div.grants > p";
            // NOTE: The element on the page has a <br/> and a newline
            // removing newline makes the search string one space shorter
            // searchString = "Информация для заявителейи исполнителей проектов";
            // making it difficult to impossible to "predict" the right matching expression
            String searchString = @"Информация для заявителей
и исполнителей проектов";

            Selene.GoToUrl(url);
            // NOTE: slurps exceptions but not in a "Nunit" way
            try {
                // Selene.S(With.Text(searchString)).Should(Be.InDom);
                Selene.S(String.Format("text={0}", searchString.Replace("\n", "").Replace("\r", "")), Selene.GetWebDriver()).Should(Be.InDom);
                // Selene.S(With.Text(searchString)).Should(Have.Text(searchString));
            } catch (TimeoutException e) {
                Console.Error.WriteLine("Exception (ignored) " + e.ToString());
            } catch (NoSuchElementException e) {
                Console.Error.WriteLine("Exception (ignored) " + e.ToString());
            }

            // Break down the element text into single line chunks, successfully find each
            string elementText = (Selene.GetWebDriver()).FindElement(By.CssSelector(cssSelector)).Text;

            elementText = Selene.S(With.Css(cssSelector)).Text;

            foreach (String line in elementText.Split('\n'))
            {
                searchString = line.Replace("\r", "");
                Console.Error.WriteLine("Searching by inner Text fragment:" + searchString);
                Selene.S(With.Text(searchString)).Should(Be.InDom);
                Selene.S(With.Text(searchString)).Should(Have.Text(searchString));
            }
        }
 public void InitDriver()
 {
     new DriverManager().SetUpDriver(new ChromeConfig());
     Selene.SetWebDriver(new ChromeDriver());
     Selene.GoToUrl("https://www.tbcbankgroup.com/");
 }