public void ClickLink() { NavigationHelper.NavigateToUrl(ObjectRepository.Config.GetWebsite()); LinkHelper.ClickLink(By.LinkText("File a Bug")); TextBoxHelper.TypeInTextBox(By.Id("Bugzilla_login"), ObjectRepository.Config.GetUsername()); TextBoxHelper.TypeInTextBox(By.Id("Bugzilla_password"), ObjectRepository.Config.GetPassword()); //TextBoxHelper.ClearTextBox(By.Id("Bugzilla_login")); //TextBoxHelper.ClearTextBox(By.Id("Bugzilla_password")); Console.WriteLine(CheckBoxHelper.IsCheckBoxChecked(By.Id("Bugzilla_restrictlogin"))); CheckBoxHelper.CheckedCheckBox(By.Id("Bugzilla_restrictlogin")); Console.WriteLine(CheckBoxHelper.IsCheckBoxChecked(By.Id("Bugzilla_restrictlogin"))); Console.WriteLine("Enabled : {0}", ButtonHelper.IsButtonEnabled(By.Id("log_in"))); Console.WriteLine("Text : {0}", ButtonHelper.GetButtonText(By.Id("log_in"))); ButtonHelper.ClickButton(By.Id("log_in")); GenericHelper.WaitForWebElement(By.Name("component"), TimeSpan.FromSeconds(30)); IWebElement element = GenericHelper.WaitForWebElementInPage(By.Name("component"), TimeSpan.FromSeconds(30)); GenericHelper.TakeScreenShot(); GenericHelper.TakeScreenShot("Test.jpeg"); }
public void TestButton() { NavigationHelper.NavigateToUrl(ObjectRepository.Config.GetWebsite()); LinkHelper.ClickLink(By.LinkText("File a Bug")); TextBoxHelper.TypeInTextBox(By.Id("Bugzilla_login"), ObjectRepository.Config.GetUsername()); TextBoxHelper.TypeInTextBox(By.Id("Bugzilla_password"), ObjectRepository.Config.GetPassword()); //IWebElement element = ObjectRepository.Driver.FindElement(By.Id("log_in")); // element.Click(); Console.WriteLine("Enabled : {0}", ButtonHelper.IsButtonEnabled(By.Id("log_in"))); Console.WriteLine("Button Text : {0}", ButtonHelper.GetButtonText(By.Id("log_in"))); ButtonHelper.ClickButton(By.Id("log_in")); }
public void TestButton() { NavigationHelper.NavigateToUrl(ObjectRepository.Config.GetWebsite()); Helper.Click(By.LinkText("File a Bug")); Helper.Text(By.Id("Bugzilla_login"), ObjectRepository.Config.GetUsername()); Helper.Text(By.Id("Bugzilla_password"), ObjectRepository.Config.GetPassword()); //ObjectRepository.Driver.FindElement(By.Id("log_in")).Click(); Console.WriteLine("Enables: {0}", ButtonHelper.IsButtonEnabled(By.Id("log_in"))); Console.WriteLine("Button Text: {0}", ButtonHelper.GetButtonText(By.Id("log_in"))); ButtonHelper.ClickButton(By.Id("log_in")); Console.WriteLine("Page: {0}", Helper.GetTitle()); }
public static void LogInNazaren() { NavigationHelper.NavigateToUrl("http://10.168.241.59/tcowebsitedemo"); TextBoxHelper.SendKeys(By.Id("txtUserName"), ObjectRepository.Config.GetNazareneUser()); TextBoxHelper.SendKeys(By.Id("txtPassword"), ObjectRepository.Config.GetNazarenPassword()); Console.WriteLine("Is the Button Log In is Enabled :{0}", ButtonHelper.IsButtonEnabled(By.Id("btnLogIn"))); Console.WriteLine("the web page title is :{0}", WindowHelper.GetTitle()); Console.WriteLine("the button text is :{0}", ButtonHelper.GetButtonText(By.Id("btnLogIn"))); ButtonHelper.ClickButton(By.Id("btnLogIn")); Thread.Sleep(3000); }
//last param means parameter with variable length public void PerformAction(string keyword, string locatorType, string locatorValue, params string[] args) { try { switch (keyword) { case "Click": ButtonHelper.ClickButton(GetElementLocator(locatorType, locatorValue)); break; case "SendKeys": TextboxHelper.TypeInTextbox(GetElementLocator(locatorType, locatorValue), args[0]); break; case "Select": ComboboxHelper.SelectElement(GetElementLocator(locatorType, locatorValue), args[0]); break; case "WaitForElement": GenericHelper.WaitforWebElementInPage(GetElementLocator(locatorType, locatorValue), TimeSpan.FromSeconds(50)); break; case "Navigate": NavigationHelper.NavigateToUrl(args[0]); break; case "GetLinkText": ButtonHelper.GetButtonText(GetElementLocator(locatorType, locatorValue)); break; case "GetLinkText_alt": ButtonHelper.GetButtonText_alt(GetElementLocator(locatorType, locatorValue)); break; case "Compare": GenericHelper.GetTextAndCompare(GetElementLocator(locatorType, locatorValue), args[0]); break; default: throw new NoSuchKeywordFoundException("Keyword Not Found : " + keyword); } } catch (Exception e) { Console.Write("Something went wrong: Keyword" + keyword + ", locator: " + locatorType); } }
public void ButtonClick() { string url = ObjectRepository.Config.GetWebsite(); NavigationHelper.NavigateToUrl(url); LinkHelper.ClickLink(By.LinkText("File a Bug")); By userTextBox = By.Id("Bugzilla_login"); string user = ObjectRepository.Config.GetUserName(); TextBoxHelper.TypeinTextBox(userTextBox, user); By passwordTextBox = By.Id("Bugzilla_password"); string password = ObjectRepository.Config.GetPassword(); TextBoxHelper.TypeinTextBox(passwordTextBox, password); By loggingButton = By.Id("log_in"); string text = ButtonHelper.GetButtonText(loggingButton); Console.WriteLine("The Text Button is: {0}", text); ButtonHelper.ClickButton(loggingButton); }
public void ClickLoginButton() { NavigationHelper.NavigationToURL(ObjectRepository.Config.GetWebsite()); LinkHelper.ClickLink(By.LinkText("File a Bug")); Thread.Sleep(100); TextBoxHelper.ClearTextbox(By.Id("Bugzilla_login")); TextBoxHelper.TypeInTextbox(By.Id("Bugzilla_login"), ObjectRepository.Config.GetUsername()); TextBoxHelper.ClearTextbox(By.Id("Bugzilla_password")); TextBoxHelper.TypeInTextbox(By.Id("Bugzilla_password"), ObjectRepository.Config.GetPassword()); Console.WriteLine(CheckboxHelper.IsChecboxChecked(By.Id("Bugzilla_restrictlogin"))); if (CheckboxHelper.IsChecboxChecked(By.Id("Bugzilla_restrictlogin"))) { CheckboxHelper.CheckedCheckbox(By.Id("Bugzilla_restrictlogin")); } Console.WriteLine(CheckboxHelper.IsChecboxChecked(By.Id("Bugzilla_restrictlogin"))); Console.WriteLine(ButtonHelper.GetButtonText(By.Id("log_in"))); Console.WriteLine(ButtonHelper.IsButtonEnabled(By.Id("log_in"))); ButtonHelper.ClickOnButton(By.Id("log_in")); }