বৃহস্পতিবার, ২৯ অক্টোবর, ২০১৫

Selenium Automation Framework P8 : Read and Write Data From Excel File


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package com.selenium.test;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.Test;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.AfterTest;

import com.selenium.pageObject.LoginPage;
import com.selenium.userAction.SignIn;
import com.selenium.util.ExcelUtil;


public class loginFacebookByExcelData {
  
  private WebDriver driver;
  
  private static String username;
  
  private static String password;
  
 
  
  @BeforeTest
  public void beforeTest() throws Exception {
    
    driver = new FirefoxDriver();
    
    //set file excel is my excel file in folder Driver , you can set the other path to your excel file
    ExcelUtil.setExcelFile(ExcelUtil.PathExcelInProject(), "test");
    //get the data from file excel
    username = ExcelUtil.getCellData(2, 1);
    password = ExcelUtil.getCellData(2, 2);
   
    
  }

  
   @Test
  public void loginByExcel() {
    //Call loading page of login page facebook , take a look in post [Page Object Model] of my blog
   LoginPage.loadPage(driver);
   //Call action SignIn , take a look in post [Modular Driven Framework] of my blogs
   SignIn.Execute(driver, username, password);
    //write data to excel
    String result = "success"
    ExcelUtil.setCellData(result,3,3);
  }
  
  @AfterTest
  public void afterTest() {
    driver.quit();
  }

}

কোন মন্তব্য নেই:

একটি মন্তব্য পোস্ট করুন