public bool CanLoadImages(GraphPageImages image) { string prefix = GraphUtility.RemoveRedundantPartsfromExtractBaseAddress(); switch (image) { case (GraphPageImages.MainBanner): var element = GraphBrowser.FindElement(By.TagName("picture")).FindElement(By.TagName("img")); string Url = element.GetAttribute("src"); //The div in Home page does not have id attribute //if (element == null) //{ // element = GraphBrowser.FindElement(By.CssSelector("div#layout-featured>div>article>div>div>div>div")); //} //string Url = ((string)(GraphBrowser.webDriver as IJavaScriptExecutor).ExecuteScript(@"return getComputedStyle(arguments[0])['background-image'];", element)).Replace(@"url(""", "").Replace(@""")", ""); return(GraphUtility.FileExist(Url)); case (GraphPageImages.Others): var elements = GraphBrowser.Driver.FindElements(By.CssSelector("img")); foreach (IWebElement item in elements) { Url = item.GetAttribute("src"); if (!GraphUtility.FileExist(Url)) { return(false); } } return(true); default: return(false); } }
public bool CanLoadImages(GraphPageImages image) { switch (image) { case (GraphPageImages.MainBanner): var element = GraphBrowser.FindElement(By.ClassName("dxp-banner-default")); string Url = ((string)(GraphBrowser.webDriver as IJavaScriptExecutor).ExecuteScript(@"return getComputedStyle(arguments[0])['background-image'];", element)).Replace(@"url(""", "").Replace(@""")", ""); return(GraphUtility.FileExist(Url)); case (GraphPageImages.Others): var elements = GraphBrowser.Driver.FindElements(By.CssSelector("img")); foreach (IWebElement item in elements) { Url = item.GetAttribute("src"); if (!GraphUtility.FileExist(Url)) { return(false); } } return(true); default: return(false); } }