Guest User

Untitled

a guest
Dec 19th, 2017
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.22 KB | None | 0 0
  1. @Test(priority=1)
  2. public void emdeonlogin() throws InterruptedException {
  3. driver.switchTo().frame(driver.findElement(Emdeon_Elements.frame1));
  4. Username = Credentials.getCell(1,0).getContents();
  5. Password = Credentials.getCell(1,1).getContents();
  6. driver.findElement(Emdeon_Elements.username).sendKeys(Username); //Entering Username
  7. driver.findElement(Emdeon_Elements.password).sendKeys(Password); //Entering Password
  8. driver.findElement(Emdeon_Elements.login).click();
  9. System.out.println("Logged In");
  10. driver.manage().timeouts().implicitlyWait(20,TimeUnit.SECONDS);
  11. }
  12.  
  13. @Test(priority=2)
  14. public void createexcel() throws InterruptedException, FileNotFoundException {
  15. ex_row_tr=1;
  16. Date d= new Date();
  17. SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yy HH-mm-ss");
  18. filepath2 = "D://Jee/Selenium WorkSpace/Input/EmdeonSearchResults_"+dateFormat.format(d)+".xlsx";
  19. fs2 = new FileOutputStream(filepath2);
  20. wb2 = new XSSFWorkbook();
  21. SearchResults = wb2.createSheet("SR");
  22. }
  23.  
  24. @Test(priority=3)
  25. public void searchscreen() throws InterruptedException, IOException {
  26. driver.findElement(Emdeon_Elements.Reporting_Analytics).click();
  27. driver.findElement(Emdeon_Elements.Claim_Mgmt).click();
  28.  
  29. int k;
  30. for(int i=0;i<Claims.getRows();i++)
  31. {
  32. k=i+1;
  33. System.out.println(k);
  34. for(int j=0;j<1;j++)
  35. {
  36. driver.manage().timeouts().implicitlyWait(70, TimeUnit.SECONDS);
  37. driver.findElement(Emdeon_Elements.Payments).click(); driver.findElement(Emdeon_Elements.Search_Remits).click();
  38. driver.manage().timeouts().implicitlyWait(70, TimeUnit.SECONDS);
  39. driver.switchTo().frame(driver.findElement(Emdeon_Elements.frame2));
  40. **Select dropdown = new Select (driver.findElement(Emdeon_Elements.Time_Period));**
  41. dropdown.selectByIndex(0);
  42. WebElement radioBtn = driver.findElement(Emdeon_Elements.By_Claim);
  43. radioBtn.click();
  44. Claim = Claims.getCell(j,i).getContents();
  45.  
  46. Thread.sleep(3000);
  47. String pp = driver.findElement(Emdeon_Elements.No_Result).getText();
  48. String qq = "Your search returns no results.";
  49.  
  50. if (pp.equals(qq))
  51. {
  52. System.out.println("No search result for "+Claim);
  53. XSSFRow row2 = SearchResults.createRow(++ex_row_tr);
  54. XSSFCell cell1 = row2.createCell(0);
  55. cell1.setCellValue(Claim);
  56. XSSFCell cell2 = row2.createCell(1);
  57. cell2.setCellValue("Your search returns no results.");
  58. ex_row_tr++;
  59. }
  60. else
  61. {
  62. driver.findElement(Emdeon_Elements.Result_1).click();
  63. Thread.sleep(3000);
  64. driver.findElement(Emdeon_Elements.Service_Line_Info).click();
  65. WebElement baseTable1 = driver.findElement(Emdeon_Elements.Heading_Table);
  66.  
  67. int Col_count1 = driver.findElements(Emdeon_Elements.Heading_Table).size();
  68. XSSFRow row1 = SearchResults.createRow(1);
  69.  
  70. for(int th_col=1;th_col<=Col_count1;th_col++)
  71. {
  72. WebElement th = baseTable1.findElement(By.xpath("//html/body/div/div[10]/div/table/thead/tr/th["+th_col+"]"));
  73. String c1 = th.getText();
  74. XSSFCell cell1 = row1.createCell(th_col);
  75. cell1.setCellValue(c1);
  76.  
  77. XSSFFont font= wb2.createFont();
  78. font.setBold(true);
  79. CellStyle style = null;
  80. style=wb2.createCellStyle();
  81. style.setFont(font);
  82. style.setAlignment(CellStyle.ALIGN_CENTER);
  83. cell1.setCellStyle(style);
  84. }
  85.  
  86. int row_count1 = driver.findElements(Emdeon_Elements.Data_Table).size();
  87.  
  88. for(int tr_col=1;tr_col<=row_count1;tr_col++)
  89. {
  90. WebElement baseTable2 = driver.findElement(By.xpath("//html/body/div/div[10]/div/table/tbody/tr["+tr_col+"]/td"));
  91. int Col_count2 = driver.findElements(By.xpath("//html/body/div/div[10]/div/table/tbody/tr["+tr_col+"]/td")).size();
  92. XSSFRow row2 = SearchResults.createRow(++ex_row_tr);
  93. XSSFCell cell1 = row2.createCell(tr_col-1);
  94. cell1.setCellValue(Claim);
  95.  
  96. for(int td_col=1;td_col<=Col_count2;td_col++)
  97. {
  98. WebElement td = baseTable2.findElement(By.xpath("//html/body/div/div[10]/div/table/tbody/tr["+tr_col+"]/td["+td_col+"]"));
  99. String c2 = td.getText();
  100. XSSFCell cell2 = row2.createCell(td_col);
  101. cell2.setCellValue(c2);
  102. }
  103. }
  104. ex_row_tr++;
  105. }
  106. System.out.println("Completed searching");
  107. driver.manage().timeouts().implicitlyWait(40, TimeUnit.SECONDS);
  108. driver.switchTo().parentFrame();
  109. }
  110. wb2.write(fs2);
  111. fs2.close();
  112. System.out.println("Wrote");
  113. driver.close();
  114. }
  115.  
  116. @BeforeMethod
  117. public void beforeMethod() throws BiffException, IOException
  118. {
  119. String filepath1 = "D://Jee/Selenium WorkSpace/Input/Emdeon.xls";
  120. FileInputStream fs1 = new FileInputStream(filepath1);
  121. wb1 = Workbook.getWorkbook(fs1);
  122. Credentials = wb1.getSheet("Credentials");
  123. Claims = wb1.getSheet("ClaimList");
  124. }
  125.  
  126. @BeforeClass
  127. public void beforeClass()
  128. {
  129. System.setProperty("webdriver.chrome.driver","D:/Utilities/Selenium/chromedriver.exe");
  130. driver = new ChromeDriver();
  131. driver.manage().window().maximize();
  132. driver.get("https://access.emdeon.com/CIHS/");
  133. System.out.println("URL loaded");
  134. }
Add Comment
Please, Sign In to add comment