Advertisement
Guest User

Untitled

a guest
Jul 12th, 2016
267
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.99 KB | None | 0 0
  1. import org.openqa.selenium.By;
  2. import org.openqa.selenium.JavascriptExecutor;
  3. import org.openqa.selenium.WebDriver;
  4. import org.openqa.selenium.WebElement;
  5.  
  6. //import EfaPackage.Data;
  7. //import EfaPackage.Module;
  8. public class EFAMasterDBNTTEclipse {
  9. public static void TT_sc01_NTTSearchField(int sc01_caseRow, Data sc01_data)
  10. {
  11. String sc01_URL = sc01_data.df_getData(sc01_caseRow, "sc01_URL");
  12. String sc01_Search = sc01_data.df_getData(sc01_caseRow, "sc01_Search");
  13. String sc01_output = "";
  14. String sc01_baseLocator = "org.openqa.selenium.By.";
  15. Module.cs_executeAction("navigate", sc01_baseLocator + "xpath", "", new String[] {"\"" + sc01_URL + "\""});
  16. Module.cs_executeAction("sendKeys", sc01_baseLocator + "xpath", "//input[@type='search']", new String[] {sc01_Search});
  17.  
  18. Module.cs_executeAction("click", sc01_baseLocator + "xpath", "//input[@type='submit']", new String[] {});
  19. Module.cs_executeAction("click", sc01_baseLocator + "xpath", "//font[@class='titb']", new String[] {});
  20. sc01_output = Module.cf_receiveAction("getText", sc01_baseLocator + "xpath", "//p[@class='pseudo-first-child']", new String[] {});
  21.  
  22. Module.cf_checkValue(sc01_caseRow, sc01_output , sc01_data);
  23.  
  24. }
  25.  
  26.  
  27. public static void TT_sc02_NTTDescriptionField(int sc02_caseRow, Data sc02_data)
  28. {
  29. String sc02_URL = sc02_data.df_getData(sc02_caseRow, "sc02_URL");
  30. //String vSearch = data.getData(caseRow, "vSearch");
  31. String output = "";
  32. String baseLocator = "org.openqa.selenium.By.";
  33. Module.cs_executeAction("navigate", baseLocator + "xpath", "", new String[] {"\"" + sc02_URL + "\""});
  34. Module.cs_executeAction("click", baseLocator + "xpath", "//span[text()[contains(.,'Industries')]]", new String[] {});
  35. Module.cs_executeAction("click", baseLocator + "xpath", "//span[text()[contains(.,'Services')]]", new String[] {});
  36. Module.cs_executeAction("click", baseLocator + "xpath", "//span[text()[contains(.,'About NTT DATA')]]", new String[] {});
  37. Module.cs_executeAction("click", baseLocator + "xpath", "//span[text()[contains(.,'Insights')]]", new String[] {});
  38. Module.cs_executeAction("click", baseLocator + "xpath", "//a[text()[contains(.,'Investor Relations')]]", new String[] {});
  39. Module.cs_executeAction("click", baseLocator + "xpath", "//a[text()[contains(.,'CSR')]]", new String[] {});
  40. Module.cs_executeAction("click", baseLocator + "xpath", "//a[text()[contains(.,'News Center')]]", new String[] {});
  41. output = "Windows successfully opened";
  42. Module.cf_checkValue(sc02_caseRow, output, sc02_data);
  43. }
  44.  
  45. public static void Remedy_Create_Incident(int caseRow, Data data)
  46. {
  47. String vRemedyURL = data.df_getData(caseRow, "vRemedyURL");
  48. String vUsername = data.df_getData(caseRow, "vUsername");
  49. String vPassword = data.df_getData(caseRow, "vPassword");
  50. //String vCompany = data.df_getData(caseRow, "vCompany");
  51. //String vUsername = data.getData(caseRow, "vUsername");
  52. String output = "";
  53. String baseLocator = "org.openqa.selenium.By.";
  54. Module.cs_executeAction("navigate", baseLocator + "xpath", "", new String[] {"\"" + vRemedyURL + "\""});
  55. Module.cs_executeAction("sendKeys", baseLocator + "xpath", "//input[@type='text']", new String[] {vUsername});
  56. Module.cs_executeAction("sendKeys", baseLocator + "xpath", "//input[@type='password']", new String[] {vPassword});
  57. Module.cs_executeAction("click", baseLocator + "xpath", "//input[@name='login']", new String[] {});
  58. Module.cs_executeAction("click", baseLocator + "xpath", "//img[@id='reg_img_304316340']", new String[] {});
  59. Module.cs_executeAction("click", baseLocator + "xpath", "//span[text()[contains(.,'Incident Management')]]", new String[] {});
  60.  
  61. //Module.cs_executeAction("click", baseLocator + "xpath", "//span[text()[contains(.,'New Incident')]]", new String[] {});
  62. WebElement element = ((WebDriver) Module.cv_driver).findElement(By.xpath("//span[text()[contains(.,'New Incident')]]"));
  63.  
  64. JavascriptExecutor executor = (JavascriptExecutor)Module.cv_driver;
  65. executor.executeScript("arguments[0].click();", element);
  66.  
  67. try {
  68. Thread.sleep(500000);
  69. } catch (InterruptedException e) {
  70. // TODO Auto-generated catch block
  71. e.printStackTrace();
  72. }
  73. //Module.cs_executeAction("click", baseLocator + "xpath", "//span[text()[contains(.,'New Incident')]]", new String[] {});
  74. //EfaLibrary.executeAction("click", baseLocator + "xpath", "//a[@onclick='javascript:CallARGHPD_58INC_58AppListEntryPointitsm_45arsEPFunc(false, this);']", new String[] {});
  75. //EfaLibrary.executeAction("click", baseLocator + "xpath", "//div[@class='item EP lvl1 VNavHover1']", new String[] {});
  76. //Module.cs_executeAction("sendKeys", baseLocator + "xpath", "//textarea[@id='arid_WIN_2_1000000082']", new String[] {vCompany});
  77. output = "Windows successfully opened";
  78. Module.cf_checkValue(caseRow, output, data);
  79. }
  80. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement