예제 #1
0
 //[TestCaseSource("WebBrowser")]
 public static void SetUpDriver()
 {
     BrowserFactory.InitBrowser(browser);
     log.WriteMessagesInFile($"Browser {browser} was initiated successfuly");
     BrowserFactory.GoToUrl(ConfigurationManager.AppSettings["URL"]);
     // BrowserFactory.GoToUrl(url);
     BrowserFactory.MaximizeWindow();
 }
예제 #2
0
 public bool IsLogOut()
 {
     BrowserFactory.GoToUrl(ConfigurationManager.AppSettings["Url"]);
     if (ConfigurationManager.AppSettings["Url"] == BrowserFactory.Driver.Url)
     {
         return(true);
     }
     log.WriteMessagesInFile("User was NOT signed out.Smth went wrong");
     return(false);
 }
예제 #3
0
        public bool IsCorrectLink(string message, string item)
        {
            OpenLastTweet();
            string url = linkTweet.GetAttribute("title");

            BrowserFactory.OpenNewTab();
            BrowserFactory.GoToUrl(url);
            log.WriteMessagesInFile($"New tab is opened with url {url}");
            switch (item)
            {
            case "correct link":
                if (url == BrowserFactory.Driver.Url)
                {
                    if (BasePageObject.FacebookHome.HomePageIsOpened())
                    {
                        BrowserFactory.CloseTab();
                        log.WriteMessagesInFile($"New tab is closed with url {url}");
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    return(false);
                }

            default:
                string path = "//div[@id='suggestions-list']//following-sibling::div[@class='error-code']";
                log.WriteMessagesInFile($"The link {url} was incorrect");
                Extensions.WaitedForElementPresent(BrowserFactory.Driver, By.XPath(path), 10);
                BrowserFactory.CloseTab();
                return(false);
            }
        }
예제 #4
0
 public void ReopenBrowser()
 {
     BrowserFactory.ReopenTab();
     BrowserFactory.GoToUrl(ConfigurationManager.AppSettings["URL"]);
     //BrowserFactory.GoToUrl(TestBases.TestBase.Url);
 }