Exemple #1
0
        public List <string> WaitForVisibilityOfAllElementTextsLocatedBy(string elementName, By byObject, List <string> itemList)
        {
            try
            {
                WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(GetWaitTimeoutSeconds()));
                List <string> list = wait.Until(CustomExpectedConditions.VisibilityOfAllElementTextsLocatedBy(byObject, itemList));

                string info = string.Format("Wait for text list to be present in element. String list: [{0}]; Element information: {1}",
                                            string.Join(", ", itemList.ToArray()), elementName);
                HtmlReporter.Pass(info);
                NLogger.Info(info);

                return(list);
            }
            catch (WebDriverTimeoutException ex)
            {
                var message = string.Format("Text list is not present in element as expected. String list: [{0}]; Element information: {1}",
                                            string.Join(", ", itemList.ToArray()), elementName);
                string screenshot = ScreenShotCapturing.TakeScreenShoot(driver, message);
                HtmlReporter.Fail(message, ex, screenshot);
                throw new ErrorHandler(message, ex);
            }
        }