public void CountLinks() { m = MethodBase.GetCurrentMethod(); log.Info(m); System.Threading.Thread.Sleep(6000); //var wait = new WebDriverWait(SeleniumUno.Main.PropertiesCollection.driver, TimeSpan.FromMilliseconds(5000)); //wait.Until(ExpectedConditions.VisibilityOfAllElementsLocatedBy(SeleniumUno.Main.PropertiesCollection.driver.FindElements(By.TagName("a")))); SurrenderAt20HomePage sur = new SurrenderAt20HomePage(); try { log.Info("Attempting to acquire links..."); foreach (IWebElement link in sur.links) { Console.WriteLine(SeleniumUno.Standard_Methods.GetMethods.GetUrl(link)); } log.Debug("Links successfully acquired."); } catch (Exception e) { log.Error($"Class: {m.ReflectedType.Name} || Method: {m.Name} || Error: {e}"); } Console.WriteLine("Number of links on the page is " + sur.links.Count); }
public void _clickHome() { System.Threading.Thread.Sleep(6000); m = MethodBase.GetCurrentMethod(); log.Info(m); String myUrl = SeleniumUno.Main.PropertiesCollection.driver.Url; SurrenderAt20HomePage sur = new SurrenderAt20HomePage(); WebDriverWait myWait = new WebDriverWait(SeleniumUno.Main.PropertiesCollection.driver, TimeSpan.FromSeconds(3)); myWait.Until(ExpectedConditions.ElementToBeClickable(sur.homeButton)); Actions s = new Actions(SeleniumUno.Main.PropertiesCollection.driver); try { log.Info("Attempting to click on button: log.debug"); s.Click(sur.homeButton).Build().Perform(); log.Debug("Button clicked successfully: log.info"); } catch (Exception e) { log.Error($"Class: {m.ReflectedType.Name} || Method: {m.Name} || Error: {e}"); } myWait.Until(ExpectedConditions.ElementToBeClickable(sur.homeButton)); Assert.IsTrue(SeleniumUno.Main.PropertiesCollection.driver.Url.Contains("index.html"), "Failed because " + myUrl + " does NOT contain 'index.html'"); Base._takesScreenshot(m.Name); }
public void _continueReading() { m = MethodBase.GetCurrentMethod(); SurrenderAt20HomePage sur = new SurrenderAt20HomePage(); Actions s = new Actions(SeleniumUno.Main.PropertiesCollection.driver); try { foreach (IWebElement cr in sur.continueReadings) { log.Debug("Attempting to click on link"); s.Click(cr).Build().Perform(); Assert.IsTrue(Base.verifyUrlConnection(SeleniumUno.Main.PropertiesCollection.driver.Url, log), $"Error with url: {SeleniumUno.Main.PropertiesCollection.driver.Url}. HttpResponse was not ok"); log.Info($"Link {SeleniumUno.Main.PropertiesCollection.driver.Url} clicked successfully"); Base._takeFullScreenshot(m.Name, SeleniumUno.Main.PropertiesCollection.driver.Title); SeleniumUno.Main.PropertiesCollection.driver.Navigate().Back(); } } catch (Exception e) { log.Error($"Class: {m.DeclaringType.Name} || Method: {m.Name} || Error: {e}"); } //IReadOnlyCollection<String>windows = SeleniumUno.Main.PropertiesCollection.driver.WindowHandles; /*foreach(String window in windows) * { * SeleniumUno.Main.PropertiesCollection.driver.SwitchTo().Window(window); * Base._takeFullScreenshot(m.Name, SeleniumUno.Main.PropertiesCollection.driver.Title); * }*/ }
public void _skinSpotlight() { m = MethodBase.GetCurrentMethod(); SurrenderAt20HomePage sur = new SurrenderAt20HomePage(); try { log.Debug("Attempting to click on link.."); sur.skinSpotlight.Click(); log.Info("Link clicked successfully!"); } catch (Exception e) { log.Error($"Class: {m.ReflectedType.Name} || Method: {m.Name} || Error: {e}"); } IReadOnlyCollection <string> windowIds = SeleniumUno.Main.PropertiesCollection.driver.WindowHandles; foreach (string id in windowIds) { SeleniumUno.Main.PropertiesCollection.driver.SwitchTo().Window(id); } System.Threading.Thread.Sleep(2000); Assert.IsTrue(SeleniumUno.Main.PropertiesCollection.driver.Url.Contains("skinspotlights")); //Base._takesScreenshot(m.Name); Base._takeFullScreenshot(m.Name); }
public void _thisWeeksHeadlines() { SurrenderAt20HomePage sur = new SurrenderAt20HomePage(); Actions s = new Actions(SeleniumUno.Main.PropertiesCollection.driver); m = MethodBase.GetCurrentMethod(); log.Info(m); int count = 1; int countCheck = 1; try { log.Info("Attempting to open all links"); foreach (IWebElement link in sur.weekHeadlines) { s.KeyDown(Keys.Control).Click(link).Build().Perform(); } log.Debug("Links clicked successfully"); } catch (Exception e) { log.Error($"Class: {m.ReflectedType.Name} || Method: {m.Name} || Error: {e}"); } countCheck = countCheck + SeleniumUno.Main.PropertiesCollection.driver.WindowHandles.Count; foreach (string id in SeleniumUno.Main.PropertiesCollection.driver.WindowHandles) { SeleniumUno.Main.PropertiesCollection.driver.SwitchTo().Window(id); Console.WriteLine($"Url {count} is: {SeleniumUno.Main.PropertiesCollection.driver.Url}"); count++; } Assert.That(count == countCheck); }
public void SendToSearchBox() { log.Info(m); SurrenderAt20HomePage sur = new SurrenderAt20HomePage(); string s = "God-King"; SeleniumUno.Standard_Methods.SetMethods.EnterText(sur.searchBox, s); Assert.That(sur.searchBox.GetAttribute("value").Equals(s)); sur.submitSearch.Submit(); System.Threading.Thread.Sleep(4000); }
public void _footerLinks() { m = MethodBase.GetCurrentMethod(); SurrenderAt20HomePage sur = new SurrenderAt20HomePage(); try { log.Debug("Attempting to click on links"); log.Info(SeleniumUno.Standard_Methods.GetMethods.ClickAllLinks(sur.footerLinks)); log.Info("Links clicked successfully!"); } catch (Exception e) { log.Error($"Class: {m.ReflectedType.Name} || Method: {m.Name} || Error: {e}"); } }
public void _blogArchive() { m = MethodBase.GetCurrentMethod(); log.Info(m); SurrenderAt20HomePage sur = new SurrenderAt20HomePage(); IList <IWebElement> selectOptions = sur.blogArchive.AllSelectedOptions; int count = 1; foreach (IWebElement option in selectOptions) { log.Info($"Option number {count} is {option.Text}"); count++; } string firstName = "LaRon"; Console.WriteLine(firstName[2]); }
public void _clickEsports() { m = MethodBase.GetCurrentMethod(); log.Info(m); SurrenderAt20HomePage sur = new SurrenderAt20HomePage(); try { sur.esportsButton.Click(); System.Threading.Thread.Sleep(6000); Console.WriteLine("Button clicked successfully"); } catch (Exception e) { Console.WriteLine("Error in clicking the element. Desc: " + e); } Assert.That(SeleniumUno.Main.PropertiesCollection.driver.Url.Contains("Esports")); }
public void _supportLink() { m = MethodBase.GetCurrentMethod(); log.Info(m); SurrenderAt20HomePage sur = new SurrenderAt20HomePage(); m = MethodBase.GetCurrentMethod(); try { log.Info("Attempting to click on link"); sur.supportLink.Click(); log.Debug("Clicked on link successfully."); } catch (Exception e) { log.Error($"Class: {m.ReflectedType.Name} || Method: {m.Name} || Error: {e}"); } System.Threading.Thread.Sleep(4000); Assert.That(SeleniumUno.Main.PropertiesCollection.driver.Url.Contains("support")); Base._takesScreenshot(m.Name); }
public void _featuredContent() { m = MethodBase.GetCurrentMethod(); log.Info(m); SurrenderAt20HomePage sur = new SurrenderAt20HomePage(); foreach (IWebElement e in sur.featuredContentLinks) { Actions s = new Actions(SeleniumUno.Main.PropertiesCollection.driver); s.KeyDown(Keys.Control).Click(e).Build().Perform(); } IReadOnlyCollection <String> windowIds = SeleniumUno.Main.PropertiesCollection.driver.WindowHandles; foreach (string id in windowIds) { int count = 1; SeleniumUno.Main.PropertiesCollection.driver.SwitchTo().Window(id); Console.WriteLine($"Link {count}'s URL is: {SeleniumUno.Main.PropertiesCollection.driver.Url}"); } }
public void _clickPbe() { m = MethodBase.GetCurrentMethod(); log.Info(m); SurrenderAt20HomePage sur = new SurrenderAt20HomePage(); try { log.Info("Attempting to click on button..."); sur.pbeButton.Click(); System.Threading.Thread.Sleep(6000); log.Debug("Button clicked successfully"); } catch (Exception e) { log.Error($"Class: {m.ReflectedType.Name} || Method: {m.Name} || Error: {e}"); } Base._takesScreenshot(m.Name); Assert.That(SeleniumUno.Main.PropertiesCollection.driver.Url.Contains("PBE")); }