public void SelectCasePriority(string priority) { if (CasePriority.Displayed) { CasePriority.Click(); var x2 = priority; var x1 = "//*[contains(text(),'"; var x3 = "')]"; Thread.Sleep(3000); driver.FindElement(By.XPath(x1 + x2 + x3)).Click(); } else { throw new Exception("Case Priority could not be selected"); } }
/* * public void CreateEnquiryCase(string orgName, string contactName, string team, string status, string priority, string triageLevel, string caseOrigin, string subject, string description) * { * WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(50)); * wait.Until(ExpectedConditions.ElementToBeClickable(_txtOrganisationName)); * OrganisationName.Clear(); * OrganisationName.SendKeys(orgName); * Thread.Sleep(2000); * wait.Until(ExpectedConditions.ElementToBeClickable(_txtContactName)); * ContactName.Clear(); * ContactName.SendKeys(contactName); * Thread.Sleep(2000); * * if (Team.Displayed) * { * Team.Click(); * var x2 = team; * var x1 = "//*[contains(text(),'"; * var x3 = "')]"; * Thread.Sleep(3000); * driver.FindElement(By.XPath(x1 + x2 + x3)).Click(); * * } * else * { * throw new Exception("Team could not be selected"); * } * if (CaseStatus.Displayed == true) * { * CaseStatus.Click(); * var x2 = status; * var x1 = "//*[contains(text(),'"; * var x3 = "')]"; * Thread.Sleep(3000); * driver.FindElement(By.XPath(x1 + x2 + x3)).Click(); * * } * else * { * throw new Exception("Status List could not be selected"); * } * if (CasePriority.Displayed) * { * CasePriority.Click(); * var x2 = priority; * var x1 = "//*[contains(text(),'"; * var x3 = "')]"; * Thread.Sleep(3000); * driver.FindElement(By.XPath(x1 + x2 + x3)).Click(); * * } * else * { * throw new Exception("Case Priority could not be selected"); * } * * wait.Until(ExpectedConditions.ElementToBeClickable(_txtTriageLevel)); * TriageLevel.Clear(); * TriageLevel.SendKeys(triageLevel); * Thread.Sleep(2000); * * if (CaseOrigin.Displayed) * { * CaseOrigin.Click(); * var x2 = caseOrigin; * var x1 = "//*[contains(text(),'"; * var x3 = "')]"; * Thread.Sleep(3000); * driver.FindElement(By.XPath(x1 + x2 + x3)).Click(); * * } * else * { * throw new Exception("Case Origin could not be selected"); * } * * wait.Until(ExpectedConditions.ElementToBeClickable(_txtSubject)); * Subject.Clear(); * Subject.SendKeys(subject); * Thread.Sleep(2000); * * wait.Until(ExpectedConditions.ElementToBeClickable(_txtDescription)); * Description.Clear(); * Description.SendKeys(description); * Thread.Sleep(2000); * * } */ public void CreateTechSupportCase(string orgName, string contactName, string technologyTeam, string caseOrigin, string workflow, string category, string status, string priority, string supportClassification, string SCLevel1, string SCLevel2, string subject, string description) { WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(50)); wait.Until(ExpectedConditions.ElementToBeClickable(_txtOrganisationName)); OrganisationName.Clear(); OrganisationName.SendKeys(orgName); Thread.Sleep(2000); wait.Until(ExpectedConditions.ElementToBeClickable(_txtContactName)); ContactName.Clear(); ContactName.SendKeys(contactName); Thread.Sleep(2000); if (TechnologyTeam.Displayed) { TechnologyTeam.Click(); var x2 = technologyTeam; var x1 = "//*[contains(text(),'"; var x3 = "')]"; Thread.Sleep(3000); driver.FindElement(By.XPath(x1 + x2 + x3)).Click(); } else { throw new Exception("Team could not be selected"); } IWebElement dropDownOriginListBox = driver.FindElement(_listCaseOrigin); SelectElement clickOrigin = new SelectElement(dropDownOriginListBox); //Thread.Sleep(2000); clickOrigin.SelectByText(caseOrigin); //Thread.Sleep(2000); IWebElement dropDownWorkFlowListBox = driver.FindElement(_listWorkflow); SelectElement clickWorkFlow = new SelectElement(dropDownWorkFlowListBox); //Thread.Sleep(2000); clickWorkFlow.SelectByText(workflow); //Thread.Sleep(2000); IWebElement dropDownCategoryListBox = driver.FindElement(_listCategory); SelectElement clickCategory = new SelectElement(dropDownCategoryListBox); //Thread.Sleep(2000); clickCategory.SelectByText(category); //Thread.Sleep(2000); IWebElement dropDownStatusListBox = driver.FindElement(_listStatus); SelectElement clickStatus = new SelectElement(dropDownStatusListBox); Thread.Sleep(2000); clickStatus.SelectByText(status); Thread.Sleep(2000); if (CasePriority.Displayed) { CasePriority.Click(); var x2 = priority; var x1 = "//*[contains(text(),'"; var x3 = "')]"; Thread.Sleep(3000); driver.FindElement(By.XPath(x1 + x2 + x3)).Click(); } else { throw new Exception("Case Priority could not be selected"); } IWebElement dropDownSCListBox = driver.FindElement(_listSupportClassification); SelectElement clickSC = new SelectElement(dropDownSCListBox); //Thread.Sleep(2000); clickSC.SelectByText(supportClassification); //Thread.Sleep(2000); IWebElement dropDownSCL1ListBox = driver.FindElement(_listSCLevel1); SelectElement clickSCL1 = new SelectElement(dropDownSCL1ListBox); //Thread.Sleep(2000); clickSCL1.SelectByText(SCLevel1); //Thread.Sleep(2000); IWebElement dropDownSCL2ListBox = driver.FindElement(_listSCLevel2); SelectElement clickSCL2 = new SelectElement(dropDownSCL2ListBox); //Thread.Sleep(2000); clickSCL2.SelectByText(SCLevel2); //Thread.Sleep(2000); wait.Until(ExpectedConditions.ElementToBeClickable(_txtSubject)); Subject.Clear(); Subject.SendKeys(subject); Thread.Sleep(2000); wait.Until(ExpectedConditions.ElementToBeClickable(_txtDescription)); Description.Clear(); Description.SendKeys(description); Thread.Sleep(2000); }