Advertisement
Guest User

Untitled

a guest
May 26th, 2016
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.54 KB | None | 0 0
  1. [TestMethod]
  2. public void Create_Job()
  3. {
  4. string jobDate = DateTime.Now.ToShortDateString();// "13/05/2016";
  5. string userName = "Paul Bicker";
  6. //string userName = "Wayne Barclay";
  7. string formKey = "PPP";
  8.  
  9. const string LoginUsername = "admin";
  10. LoginUser(LoginUsername);
  11.  
  12. const string LoginPassword = "rhi786";
  13. LoginPass(LoginPassword);
  14.  
  15. _driver.FindElement(By.Id("LiJobs")).Click();
  16.  
  17. string H1Xpath = "//div[contains(@id, 'ctl00_MainContent_RadAjaxPanel1')]/h1";
  18.  
  19. IWebElement H1Tag = _driver.FindElement(By.XPath(H1Xpath));
  20.  
  21. string H1Text = H1Tag.Text;
  22.  
  23. for (int i = 0; i < 50; i++)
  24. {
  25. _driver.FindElement(By.Id("ctl00_MainContent_btnAddJob_input")).Click();
  26.  
  27. _driver.FindElement(By.Id("ctl00_MainContent_cmbCompanies_Arrow")).Click();
  28.  
  29. _driver.FindElement(By.Id("ctl00_MainContent_cmbCompanies_Input")).SendKeys("Nine" + Keys.Enter);
  30.  
  31. WebDriverWait wait = new WebDriverWait(_driver, TimeSpan.FromSeconds(20));
  32.  
  33. Thread.Sleep(1000);
  34.  
  35. _driver.FindElement(By.Id("ctl00_MainContent_cmbSite_Input")).SendKeys("Nine" + Keys.Enter);
  36.  
  37. Thread.Sleep(1000);
  38.  
  39. IWebElement CustomerRef = _driver.FindElement(By.Id("MainContent_txtcustomerRef"));
  40. CustomerRef.SendKeys("123456");
  41.  
  42. _driver.FindElement(By.Id("ctl00_MainContent_rdpJobDate_dateInput")).SendKeys(jobDate);
  43.  
  44. _driver.FindElement(By.Id("ctl00_MainContent_lstUser_Input")).SendKeys(userName + Keys.Enter);
  45.  
  46. IWebElement JobDesc = _driver.FindElement(By.Id("MainContent_txtJobDescription"));
  47. JobDesc.SendKeys("Test");
  48.  
  49. IWebElement Notes = _driver.FindElement(By.Id("MainContent_txtNotes"));
  50. Notes.SendKeys("123456");
  51.  
  52. _driver.FindElement(By.Id("ctl00_MainContent_cmbTasks_Input")).SendKeys(formKey + Keys.Enter);
  53.  
  54. Thread.Sleep(1000);
  55.  
  56. _driver.FindElement(By.Id("ctl00_MainContent_cmbAsset_Input")).SendKeys("S" + Keys.Enter);
  57.  
  58. Thread.Sleep(1000);
  59.  
  60. _driver.FindElement(By.Id("ctl00_MainContent_btnSave_input")).Click();
  61.  
  62. Thread.Sleep(2000);
  63.  
  64. _driver.FindElement(By.ClassName("rwInnerSpan")).Click();
  65.  
  66. Thread.Sleep(2000);
  67. }
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement