Advertisement
Guest User

Untitled

a guest
Oct 5th, 2016
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.36 KB | None | 0 0
  1. package LandingPage;
  2. import java.util.Scanner;
  3. import org.openqa.selenium.chrome.ChromeDriver;
  4. public class LandingPage {`public static String getValue(String x)
  5. {
  6. System.out.println(x);
  7. return x;
  8. }
  9. static Organization obj;
  10. public static void main(String[] args) throws InterruptedException {
  11. char ch;
  12. String org ;
  13. do
  14. {`System.out.println("List of Landing Page, Now we have 33 Landing page: nn" +"Google n" + "Roche n" +"Bayer n" + "Cartus n");
  15. Scanner reader = new Scanner(System.in);
  16. System.out.println("Enter a Organization Name: n ");
  17. org = reader.nextLine();
  18. obj=Organization.valueOf(org);`switch(obj)
  19. {
  20.  
  21.  
  22. case Google:
  23. String getvalue =google.G_LP();
  24. String y = getvalue;
  25. getValue(y);
  26. System.out.println(getvalue+" ");
  27. break;
  28. case Roche:
  29. Roche.R_LP();
  30. break;
  31. case Bayer:
  32. Bayer.bayerfill();
  33. break;
  34. case Cartus:
  35. Cartus.Cartusfill();
  36. break;
  37. default:
  38. System.out.println(" Organization is not listed into the list please select from the list: n ");
  39. }
  40. package DataBase;
  41. import java.sql.*;
  42. import LandingPage.LandingPage;`public class Database {
  43. public static void main(String[] args ) throws InterruptedException {
  44. String dbURL = "jdbc:mysql://qa-0.ls.vu:3306/learnship_local";
  45. String username ="root";
  46. String password = "learnship";
  47. String query_1, value, value_1;
  48. LandingPage ob=new LandingPage();
  49. String getmail=ob.getValue(x);
  50. System.out.println(getmail);
  51. Connection dbCon = null;
  52. Statement stmt = null;
  53. try {
  54. Class.forName("com.mysql.jdbc.Driver");
  55. //getting database connection to MySQL server
  56. dbCon =DriverManager.getConnection(dbURL, username, password);
  57.  
  58. System.out.println("connection successful");
  59. stmt = dbCon.createStatement();
  60.  
  61. query_1= "SELECT first_name,last_name FROM person WHERE email= '" + getmail + "'";
  62. ResultSet result = stmt.executeQuery(query_1);
  63.  
  64. while ( result.next() ) {
  65. value = result.getString("first_name");
  66. value_1 = result.getString("last_name");
  67.  
  68. String name=value+""+value_1;
  69. System.out.println(name);
  70. // con=value.value1;
  71. }
  72. result.close();
  73. } catch (Exception ex) {
  74. System.err.println("Got an exception! ");
  75. System.err.println(ex.getMessage());
  76.  
  77. }
  78.  
  79. }
  80.  
  81. }
  82. public class google extends LandingPage {
  83.  
  84. public static String G_LP() throws InterruptedException{
  85. String getmail="aali3009@outlook.com";
  86. System.setProperty("webdriver.chrome.driver","E:\workspace\chromeDriver\chromeDriver.exe");
  87. ChromeDriver driver = new ChromeDriver();
  88. driver.get("http://qa-0.ls.vu/v2/landing-page/google");
  89.  
  90. driver.findElement(By.xpath("/html/body/div[3]/div/div/div/p[2]/a/small")).click();
  91.  
  92. driver.findElement(By.xpath("/html/body/div[9]/div/div[2]/div/div/div/form/div[3]/div[1]/input")).sendKeys("Emmaname");
  93.  
  94. driver.findElement(By.xpath("/html/body/div[9]/div/div[2]/div/div/div/form/div[3]/div[2]/input")).sendKeys("Mohaname");
  95.  
  96. driver.findElement(By.xpath("/html/body/div[9]/div/div[2]/div/div/div/form/div[4]/div/input")).sendKeys(getmail);
  97.  
  98. driver.findElement(By.xpath("/html/body/div[9]/div/div[2]/div/div/div/form/div[5]/div")).click();
  99. driver.findElementById("checkbox2").click();
  100. driver.findElementById("checkbox1").click();
  101. driver.findElementById("js-register").click();
  102. return getmail;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement