public void CanNavigateThroughAUserFlow() { WebBrowser browser = new LoggingBrowser(new WebBrowser()); browser.Start(BrowserList.Chrome); browser.GoTo("https://www.reddit.com"); By loginBtnBy = By.XPath("//*[text() = 'Log In']"); browser.FindElement(loginBtnBy).Click(); browser.Quit(); }
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(); }
public void iFramesTest() { By loginBtnBy = By.XPath("//*[text() = 'Log In']"); By loginTxtBy = By.XPath("//*[@id='loginUsername']"); string url = "http://www.reddit.com"; WebBrowser browser = new LoggingBrowser(new WebBrowser()); browser.Start(BrowserList.Chrome); browser.GoTo(url); browser.FindElement(loginBtnBy).Click(); Element usernameTextField = browser.FindElement(loginTxtBy); usernameTextField?.TypeText("derp"); browser.Quit(); }
private static void SeleniumTest(string path) { string testFilePath = "Resources/LoginWithFailingUsername.tea"; var tea = new TeaFile(path); WebBrowser browser = new LoggingBrowser(new WebBrowser()); browser.Start(BrowserList.Chrome); browser.GoTo(tea.URL); try { foreach (var line in tea.ActionLines) { new DoAction(ref browser, line.Action).SelectBy(line.By) .Execute(line.Text); } } finally { browser.Quit(); } }