public void Run() { WeavverApp weavver = new WeavverApp(); webDriver.Navigate().GoToUrl(BaseURL + "/Logistics_Products/Showcase.aspx"); WaitForPageLoad(); ClickButton(By.Id("saleschat")); IWebDriver popupDriver = null; ReadOnlyCollection <String> windowIterator = webDriver.WindowHandles; foreach (string windowHandle in windowIterator) { popupDriver = webDriver.SwitchTo().Window(windowHandle); if (popupDriver.Title == "Weavver Chat") { break; } } WeavverTest popup = new WeavverTest(); popup.webDriver = popupDriver; popup.SetControlValue(By.Id("UserName"), "Jane Doe"); popup.SetControlValue(By.Id("EmailAddress"), "*****@*****.**"); popup.SetControlValue(By.Id("PhoneNumber"), "714-555-1212"); popup.SetControlValue(By.Id("PhoneNumber"), "714-555-1212"); FindElement(By.Id("Department_0")).Click(); popup.SetControlValue(By.Id("Inquiry"), "I have some questions about your chat products..."); popup.ClickButton(By.Id("submit")); WaitForTextExists2("#status", "connected"); popup.ClickButton(By.Id("EndChat")); WaitForTextExists(By.Id("thankyou"), "Thank you for contacting us"); }
public void Run() { WeavverApp weavver = new WeavverApp(); webDriver.Navigate().GoToUrl(BaseURL + "/Logistics_Products/Showcase.aspx"); WaitForPageLoad(); ClickButton(By.Id("saleschat")); IWebDriver popupDriver = null; ReadOnlyCollection<String> windowIterator = webDriver.WindowHandles; foreach (string windowHandle in windowIterator) { popupDriver = webDriver.SwitchTo().Window(windowHandle); if (popupDriver.Title == "Weavver Chat") { break; } } WeavverTest popup = new WeavverTest(); popup.webDriver = popupDriver; popup.SetControlValue(By.Id("UserName"), "Jane Doe"); popup.SetControlValue(By.Id("EmailAddress"), "*****@*****.**"); popup.SetControlValue(By.Id("PhoneNumber"), "714-555-1212"); popup.SetControlValue(By.Id("PhoneNumber"), "714-555-1212"); FindElement(By.Id("Department_0")).Click(); popup.SetControlValue(By.Id("Inquiry"), "I have some questions about your chat products..."); popup.ClickButton(By.Id("submit")); WaitForTextExists2("#status", "connected"); popup.ClickButton(By.Id("EndChat")); WaitForTextExists(By.Id("thankyou"), "Thank you for contacting us"); }
//------------------------------------------------------------------------------------------- public void Register(string emailAddress, string userName, string password, bool checkingOut) { WeavverTest wt = new WeavverTest(); // enter user info wt.SetControlValue(By.Id("Content_RegisterUser_Wizard1_ctl09_FirstName"), "John"); wt.SetControlValue(By.Id("Content_RegisterUser_Wizard1_ctl09_LastName"), "Doe"); wt.SetControlValue(By.Id("Content_RegisterUser_Wizard1_ctl09_OrganizationName"), "Sprockets, Inc."); wt.SetControlValue(By.Id("Content_RegisterUser_Wizard1_ctl09_EmailAddress"), emailAddress); wt.SetControlValue(By.Id("Content_RegisterUser_Wizard1_ctl09_UserName"), userName); wt.SetControlValue(By.Id("Content_RegisterUser_Wizard1_ctl09_Password"), password); wt.webDriver.FindElement(By.Name("ctl00$Content$RegisterUser$Wizard1$__CustomNav0$Next")).Click(); wt.WaitForPageLoad(); if (!checkingOut) { // bypass captcha test wt.SetControlValue(By.Id("recaptcha_response_field"), Helper.GetAppSetting("recaptcha_bypasskey")); wt.webDriver.FindElement(By.Id("Content_RegisterUser_Wizard1_ctl10_Register")).Click(); // download e-mail/activate account Activate(); } }