Advertisement
Guest User

Untitled

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