Пример #1
0
        public void CanSelectFromBrowserActionLine()
        {
            var act1      = "click";
            var selector1 = "xpath";
            var locator1  = "//html";
            var list      = new List <Token>()
            {
                new Token(Token.TokenType.TOKEN_ACTION, 0, act1),
                new Token(Token.TokenType.TOKEN_ACTION, 1, selector1),
                new Token(Token.TokenType.TOKEN_ACTION, 2, locator1),
                new Token(Token.TokenType.TOKEN_EOE, 3, null)
            };
            var browserActionLine = new BrowserActionLine(list);

            WebBrowser browser = new LoggingBrowser(new WebBrowser());

            browser.Start(BrowserList.Chrome);
            // browser.GoTo("https://www.reddit.com");
            DoAction by;

            foreach (var line in browserActionLine.ActionLines)
            {
                by = new DoAction(ref browser, line.Action);
                ActionStrategy actionStrategy = by.SelectBy(line.By);
                Assert.NotNull(actionStrategy);
            }

            browser.Quit();
        }
Пример #2
0
        public void CanRunASeleniumTest()
        {
            var        tea     = new TeaFile("./../../../Resources/LoginWithFailingUsername.tea");
            WebBrowser browser = new LoggingBrowser(new WebBrowser());

            browser.Start(BrowserList.Chrome);
            browser.GoTo(tea.URL);

            foreach (var line in tea.ActionLines)
            {
                DoAction       doAction = new DoAction(ref browser, line.Action);
                ActionStrategy strategy = doAction.SelectBy(line.By);
                strategy.Execute(line.Text);
            }

            browser.Quit();
        }