Beispiel #1
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);
            }
        }