Advertisement
Guest User

Untitled

a guest
Jan 2nd, 2017
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.82 KB | None | 0 0
  1. package selenium2Pack;
  2.  
  3. static FirefoxDriver driver = new FirefoxDriver();
  4. loginPOI xpath;
  5.  
  6. @Test
  7. public void AddEducation() throws InterruptedException{
  8.  
  9. loginPOI.CounselorLogin();
  10. Thread.sleep(10000);
  11. //Click on Education tab
  12. driver.findElement(By.xpath("html/body/div/div[2]/div/div/div/div[2]/div/div[1]/nav/ul/li[2]/a")).click();
  13. Thread.sleep(5000);
  14. //Click on AddNew button
  15. driver.findElement(By.xpath("html/body/div/div[2]/div/div/div/div[2]/div/div[3]/div/div[1]/a/i")).click();
  16.  
  17. }
  18.  
  19. package selenium2Pack;
  20.  
  21. static FirefoxDriver driver = new FirefoxDriver();
  22. static String firstName = "html/body/div/div[2]/div/div/div/div[2]/div/div/form/div[1]/div[1]/div[1]/input";
  23. String Email,LastName,BrowseButton,Username,Password,ContactNo,Gender,DOB,Country,State,City,Street,Address,Marital_status,Logout,EducationTab;
  24. static String RegisterURl = "http://192.163.222.186/~puzzlelife/development/#/register";
  25. static String LoginURL = "http://192.163.222.186/~puzzlelife/development/#/login";
  26. public void main() throws InterruptedException{
  27. String firstName = "html/body/div/div[2]/div/div/div/div[2]/div/div/form/div[1]/div[1]/div[1]/input";
  28. String LastName = "html/body/div/div[2]/div/div/div/div[2]/div/div/form/div[1]/div[1]/div[2]/input";
  29. String BrowseButton = "html/body/div/div[2]/div/div/div/div[2]/div/div/form/div[1]/div[2]/div[1]/input[1]";
  30. String Email = "html/body/div/div[2]/div/div/div/div[2]/div/div/form/div[1]/div[2]/div[2]/input";
  31. String Username = "html/body/div/div[2]/div/div/div/div[2]/div/div/form/div[1]/div[3]/div[1]/input";
  32. String Password = "html/body/div/div[2]/div/div/div/div[2]/div/div/form/div[1]/div[3]/div[2]/input";
  33. String ContactNo = "html/body/div/div[2]/div/div/div/div[2]/div/div/form/div[1]/div[3]/div[2]/input";
  34. String Gender = "html/body/div/div[2]/div/div/div/div[2]/div/div/form/div[1]/div[4]/div[2]/select";
  35. String DOB = "html/body/div/div[2]/div/div/div/div[2]/div/div/form/div[1]/div[5]/div[1]/div/span/span";
  36. String Country = "html/body/div/div[2]/div/div/div/div[2]/div/div/form/div[1]/div[5]/div[1]/div/span/span";
  37. String State = "html/body/div/div[2]/div/div/div/div[2]/div/div/form/div[1]/div[6]/div[1]/select";
  38. String City = "html/body/div/div[2]/div/div/div/div[2]/div/div/form/div[1]/div[6]/div[2]/select";
  39. String Street = "html/body/div/div[2]/div/div/div/div[2]/div/div/form/div[1]/div[7]/div[1]/input";
  40. String Address = "html/body/div/div[2]/div/div/div/div[2]/div/div/form/div[1]/div[7]/div[2]/textarea";
  41. String Marital_status = "html/body/div/div[2]/div/div/div/div[2]/div/div/form/div[1]/div[8]/div/select";
  42. String Logout = "html/body/div/header/div/div[3]/div/a[2]";
  43. String EducationTab = "html/body/div/div[2]/div/div/div/div[2]/div/div[1]/nav/ul/li[2]/a";
  44. }
  45.  
  46. public static void CounselorLogin() throws InterruptedException{
  47.  
  48. driver.get(LoginURL);
  49. Thread.sleep(15000);
  50. driver.findElement(By.id("username")).sendKeys("arun");
  51. driver.findElement(By.id("password")).sendKeys("arun");
  52. Thread.sleep(5000);
  53. WebElement submit =driver.findElement(By.xpath("html/body/div/div[2]/div/div[2]/div/div/div[2]/div/form/button"));
  54. submit.click();
  55. Thread.sleep(5000);
  56. String CurrentURL = driver.getCurrentUrl();
  57. if(LoginURL.equals(CurrentURL))
  58. System.out.println( "Un-Successful to login");
  59. else
  60. System.out.println("Successful to login");
  61. Thread.sleep(10000);
  62. }
  63.  
  64. public static void Logout() throws InterruptedException{
  65.  
  66. //Click on Logout Button
  67. driver.findElement(By.xpath("html/body/div/header/div/div[3]/div/a[2]")).click();
  68.  
  69. Thread.sleep(5000);
  70.  
  71. //Check text on page
  72. if(driver.getPageSource().contains("Login"))
  73.  
  74. System.out.println("Successfully Logout");
  75. else
  76.  
  77. System.out.println("Un-Successfully Logout");
  78.  
  79. }
  80.  
  81. public static void DOB(){
  82.  
  83.  
  84. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement