带有selenium的java中的错误:期望[object Undefined] undefined为字符串

时间:2017-04-06 09:23:38

标签: java csv selenium

我不明白为什么我得到错误预期[object Undefined] undefined为一个字符串

这是脚本java FindElements.java:

package selenium;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.How;


public class FindElements {

final WebDriver driver;

@FindBy(how = How.XPATH, using = "//*[@id='container']/div[1]/div[1]/div/div[2]/div/div[1]/div/div[1]/div[3]/div[1]/div/input")
public WebElement PSEUDO;

@FindBy(how = How.XPATH, using = "//*[@id='container']/div[1]/div[1]/div/div[2]/div/div[1]/div/div[1]/div[3]/div[2]/div/input")
public WebElement MDP;

@FindBy(how = How.CLASS_NAME, using = "//*[@id='container']/div[1]/div[1]/div/div[2]/div/div[1]/div/div[1]/button")
public WebElement CONNECT;

public FindElements(WebDriver driver){
    this.driver = driver;
}

public void connexionWD(String EmailConnect, String MdpConnect){
    PSEUDO.sendKeys(EmailConnect);
    MDP.sendKeys(MdpConnect);
    CONNECT.click();
}

}

这是脚本java SeleniumTest2.java:

package selenium;
//import com.relevantcodes.extentreports.ExtentReports;
//import com.relevantcodes.extentreports.ExtentTest;
//import com.relevantcodes.extentreports.LogStatus;
import java.io.IOException;
import org.testng.annotations.Test;
//import org.testng.ITestResult;
//import org.testng.annotations.AfterMethod;
import org.testng.annotations.DataProvider;
import java.io.FileReader;
import java.util.List;
import com.opencsv.*;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.PageFactory;
import org.openqa.selenium.remote.DesiredCapabilities;
//import library.Utility;

public class SeleniumTest2 {

//ExtentReports report;
//ExtentTest logger;

private static WebDriver driver = null;

@DataProvider(name = "testPlan")
public Object[][] motCles() throws IOException {
  //Lecture du plan de test avec Open CSV
  CSVReader reader = new CSVReader(new FileReader(".\\csv\\testplan.csv"), ';', '"', 1);
         int i = 0;
         List<String[]> allRows = reader.readAll();
         Object testPlan[][]= new Object[allRows.size()][3];
         for(String[] row : allRows){
               testPlan[i][0] = row[0];
               testPlan[i][1] = row[1];
               testPlan[i][2] = row[2];
               i++;
         }
         reader.close();
  return testPlan;
}


@Test(dataProvider = "testPlan")

public void testCas(String nomTest, String descTest, String descTest1) throws Exception {

    System.out.println(descTest1);
    //report = new ExtentReports("C:\\test-output\\SortieReport.html");

    //logger = report.startTest("Test de Report Celia");

    //Lecture du cas de test avec OpenCSV
    CSVReader reader = new CSVReader(new FileReader("C:\\Users\\ng647f1\\Desktop\\Worspaces_Automation\\WD_Automation\\WD_Automation_EXPORT\\WD_Automation\\csv\\testcase1.csv"), ';', '"', 1);

    //System.setProperty("webdriver.chrome.driver", "chromedriver.exe");
    //System.setProperty("webdriver.ie.driver", "IEDriverServer.exe");
    System.setProperty("webdriver.gecko.driver","C:\\Users\\ng647f1\\Desktop\\Worspaces_Automation\\WD_Automation\\WD_Automation_EXPORT\\WD_Automation\\geckodriver.exe");

    int i = 0;
    int j = 0;

    System.out.println("###################################################");
    System.out.println("##### TEST : " + nomTest);
    System.out.println("##### DESCRIPTION : " + descTest);
    System.out.println("###################################################");

    List<String[]> allRows = reader.readAll();
    String testDescription[][]= new String[50][21];

    //Sélection du navigateur utilisé pour le test en cours. Ce navigateur est défini dans les cas de tests.
    DesiredCapabilities capabilities;
    capabilities = DesiredCapabilities.firefox();
    capabilities.setCapability("marionette", true);
    capabilities.setCapability("proxyType", "pac");
    capabilities.setCapability("acceptInsecureCerts", true);
    capabilities.setCapability("browser.private.browsing.autostart", true); 

    //System.out.println("Le fichier csv ressemble à : " + allRows);

    driver = new FirefoxDriver(capabilities);

    //On agrandit la fenêtre de test pour éviter les problèmes d'invisibilité d'éléments avec ChromeDriver.
    driver.manage().window().maximize();
    //On définit le temps d'attente avant qu'un cas de test tombe en erreur quand un élément n'est pas trouvé.
    driver.manage().timeouts().implicitlyWait(1000, TimeUnit.SECONDS);

    //On lit les paramètres du cas de test dans le fichier du plan de test
    for(String[] row : allRows){
          for(j = 0; j<=20; j++){
                 //System.out.println("Regarde mes lignes :"+row[j]);
                 testDescription[i][j] = row[j];
          }
          if (testDescription[i][0] != null) {
                 //On lance le cas de test
                 testEtape(testDescription[i][0], testDescription[i][1], testDescription[i][2], testDescription[i][3], testDescription[i][4], testDescription[i][5], testDescription[i][6], testDescription[i][7], testDescription[i][8], testDescription[i][9], testDescription[i][10], testDescription[i][11], testDescription[i][12], testDescription[i][13], testDescription[i][14], testDescription[i][15], testDescription[i][16], testDescription[i][17], testDescription[i][18], testDescription[i][19], testDescription[i][20]);
          }
          i++;
    }
    driver.quit();
    reader.close();     
}

//@AfterMethod
//public void tearDown(ITestResult result){
//if(result.getStatus()==ITestResult.FAILURE){
//  String screenshot_path=Utility.captureScreenshot(driver, result.getName());
//  String image= logger.addScreenCapture(screenshot_path);
//  logger.log(LogStatus.FAIL, "Title verification", image);
//  }
//  report.endTest(logger);
//  report.flush();
//  driver.get("C:\\test-output\\SortieReport.html");
//}



// Interprétation des mots-clés
public void testEtape(String motCle, String paramTest1, String paramTest2, String paramTest3, String paramTest4, String paramTest5, String paramTest6, String paramTest7, String paramTest8, String paramTest9, String paramTest10, String paramTest11, String paramTest12, String paramTest13, String paramTest14, String paramTest15, String paramTest16, String paramTest17, String paramTest18, String paramTest19, String paramTest20) throws Exception {    

//On initialise les classes des pages avec PageFactory
FindElements FindElements1 = PageFactory.initElements(driver, FindElements.class);

//Pour chaque mot clé, des actions sont lancées. Certaines de ces actions sont des fonctions définies dans les classes des pages
switch(motCle.toUpperCase()){ 
    case "ALLER":
        //logger.log(LogStatus.INFO, "Browser started ");
        System.out.println("Connexion au site : " + paramTest1);
        driver.get(paramTest1);
        driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
        //logger.log(LogStatus.INFO, "Application is up and running");
    break;
    case "CONNEXION":
         System.out.println("ICI REGARDE CELA : "+ paramTest1);
         System.out.println("ICI REGARDE CELA : "+ paramTest2);
         FindElements1.connexionWD(paramTest1, paramTest2);
         driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
         //logger.log(LogStatus.PASS, "Connexion verified");
    break;
    default :
         System.out.println("||||| Mot clé non trouvé : " + motCle.toUpperCase());  
}

}

}

它使用一个csv,testcase1.csv:

Mot clé;Paramètre 1;Paramètre 2;Paramètre 3;Paramètre 4;Paramètre 5;Paramètre 6;Paramètre 7;Paramètre 8;Paramètre 9;Paramètre 10;Paramètre 11;Paramètre 12;Paramètre 13;Paramètre 14;Paramètre 15;Paramètre 16;Paramètre 17;Paramètre 18;Paramètre 19;Paramètre 20
ALLER;https://wd3-impl.workday.com/ag_preview/login.htmld?redirect=n;;;;;;;;;;;;;;;;;;;
CONNEXION;MyMail;MyPassword;;;;;;;;;;;;;;;;;;

我真的需要帮助。几天之后我就被封锁了。

编辑:现在我的堆栈跟踪是:

[TestNG] Running:
C:\Temp\testng-eclipse-1331936303\testng-customsuite.xml

Test sur la connexion
###################################################
##### TEST : Connexion
##### DESCRIPTION : testcases\testcase1.csv
###################################################
1491556971737   geckodriver INFO    Listening on 127.0.0.1:13251
1491556972447   mozprofile::profile INFO    Using profile path C:\Temp \rust_mozprofile.JJyd4lX30nqB
1491556972455   geckodriver::marionette INFO    Starting browser C:\Program   Files\Nightly\firefox.exe with args []
1491556972464   geckodriver::marionette INFO    Connecting to Marionette on localhost:65189
1491556973364   Marionette  WARN    Deprecated preference marionette.defaultPrefs.enabled detected, please use marionette.enabled
[GPU 2712] WARNING: pipe error: 109: file c:/builds/moz2_slave/m-cen-w64-ntly-000000000000000/build/src/ipc/chromium/src/chrome/common/ipc_channel_win.cc, line 346
1491556975608   Marionette  INFO    Listening on port 65189
[Child 4744] WARNING: pipe error: 109: file c:/builds/moz2_slave/m-cen-w64-ntly-000000000000000/build/src/ipc/chromium/src/chrome/common/ipc_channel_win.cc, line 346
[Child 4744] WARNING: pipe error: 109: file c:/builds/moz2_slave/m-cen-w64-ntly-000000000000000/build/src/ipc/chromium/src/chrome/common/ipc_channel_win.cc, line 346
1491556976136   Marionette  WARN    TLS certificate errors will be ignored for   this session
avr. 07, 2017 11:22:56 AM org.openqa.selenium.remote.ProtocolHandshake createSession
INFOS: Detected dialect: W3C
Connexion au site : https://wd3-impl.workday.com/ag_preview/login.htmld?redirect=n
ICI REGARDE CELA : MyMail
ICI REGARDE CELA : MyPassword
[Utils] Attempting to create C:\Users\ng647f1\Desktop\Worspaces_Automation\WD_Automation\WD_Automation_EXPORT\WD_Automation\test-output\Default suite\Default test.xml
[Utils]   Directory C:\Users\ng647f1\Desktop\Worspaces_Automation\WD_Automation\WD_Automation_EXPORT\WD_Automation\test-output\Default suite exists: true
[Utils] Attempting to create C:\Users\ng647f1\Desktop\Worspaces_Automation\WD_Automation\WD_Automation_EXPORT\WD_Automation\test-output\Default suite\Default test0.xml
[Utils]   Directory C:\Users\ng647f1\Desktop\Worspaces_Automation\WD_Automation\WD_Automation_EXPORT\WD_Automation\test-output\Default suite exists: true
FAILED: testCas("Connexion", "testcases\testcase1.csv", "Test sur la connexion")
org.openqa.selenium.InvalidArgumentException: Expected [object Undefined] undefined to be a string
Build info: version: '3.3.1', revision: '5234b325d5', time: '2017-03-10 09:10:29 +0000'
System info: host: 'TOLX300092143', ip: '44.10.108.53', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_121'
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{moz:profile=C:\Temp\rust_mozprofile.JJyd4lX30nqB, rotatable=false, timeouts={implicit=0, pageLoad=300000, script=30000}, pageLoadStrategy=normal, platform=ANY, specificationLevel=0, moz:accessibilityChecks=false, acceptInsecureCerts=true, browserVersion=55.0a1, platformVersion=6.1, moz:processID=6804, browserName=firefox, platformName=windows_nt}]
Session ID: f8de37d0-811b-4a68-be7c-86b076d2f703
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:133)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:99)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:43)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:163)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:82)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:604)
at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:274)
at org.openqa.selenium.remote.RemoteWebElement.sendKeys(RemoteWebElement.java:98)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at   org.openqa.selenium.support.pagefactory.internal.LocatingElementHandler.invoke(LocatingElementHandler.java:51)
at com.sun.proxy.$Proxy6.sendKeys(Unknown Source)
at selenium.FindElements.connexionWD(FindElements.java:27)
at selenium.SeleniumTest2.testEtape(SeleniumTest2.java:137)
at selenium.SeleniumTest2.testCas(SeleniumTest2.java:97)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at   org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:100)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:646)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:811)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1137)
at  org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:129)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112)
at org.testng.TestRunner.privateRun(TestRunner.java:753)
at org.testng.TestRunner.run(TestRunner.java:607)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:368)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:363)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:321)
at org.testng.SuiteRunner.run(SuiteRunner.java:270)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1284)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1209)
at org.testng.TestNG.runSuites(TestNG.java:1124)
at org.testng.TestNG.run(TestNG.java:1096)
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:132)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:230)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:76)


===============================================
Default test
Tests run: 1, Failures: 1, Skips: 0
===============================================


===============================================
Default suite
Total tests run: 1, Failures: 1, Skips: 0
===============================================

[Utils] Attempting to create C:\Users\ng647f1\Desktop\Worspaces_Automation\WD_Automation\WD_Automation_EXPORT\WD_Automation\test-output\old\Default suite\toc.html
[Utils]   Directory C:\Users\ng647f1\Desktop\Worspaces_Automation\WD_Automation\WD_Automation_EXPORT\WD_Automation\test-output\old\Default suite exists: true
[Utils] Attempting to create C:\Users\ng647f1\Desktop\Worspaces_Automation\WD_Automation\WD_Automation_EXPORT\WD_Automation\test-output\old\Default suite\Default test.properties
[Utils]   Directory C:\Users\ng647f1\Desktop\Worspaces_Automation\WD_Automation\WD_Automation_EXPORT\WD_Automation\test-output\old\Default suite exists: true
[Utils] Attempting to create C:\Users\ng647f1\Desktop\Worspaces_Automation\WD_Automation\WD_Automation_EXPORT\WD_Automation\test-output\old\Default suite\index.html
[Utils]   Directory C:\Users\ng647f1\Desktop\Worspaces_Automation\WD_Automation\WD_Automation_EXPORT\WD_Automation\test-output\old\Default suite exists: true
[Utils] Attempting to create C:\Users\ng647f1\Desktop\Worspaces_Automation\WD_Automation\WD_Automation_EXPORT\WD_Automation\test-output\old\Default suite\main.html
[Utils]   Directory C:\Users\ng647f1\Desktop\Worspaces_Automation\WD_Automation\WD_Automation_EXPORT\WD_Automation\test-output\old\Default suite exists: true
 [Utils] Attempting to create C:\Users\ng647f1\Desktop\Worspaces_Automation\WD_Automation\WD_Automation_EXPORT\WD_Automation\test-output\old\Default suite\groups.html
[Utils]   Directory C:\Users\ng647f1\Desktop\Worspaces_Automation\WD_Automation\WD_Automation_EXPORT\WD_Automation\test-output\old\Default suite exists: true
[Utils] Attempting to create C:\Users\ng647f1\Desktop\Worspaces_Automation\WD_Automation\WD_Automation_EXPORT\WD_Automation\test-output\old\Default suite\classes.html
[Utils]   Directory C:\Users\ng647f1\Desktop\Worspaces_Automation\WD_Automation\WD_Automation_EXPORT\WD_Automation\test-output\old\Default suite exists: true
[Utils] Attempting to create C:\Users\ng647f1\Desktop\Worspaces_Automation\WD_Automation\WD_Automation_EXPORT\WD_Automation\test-output\old\Default suite\reporter-output.html
[Utils]   Directory C:\Users\ng647f1\Desktop\Worspaces_Automation\WD_Automation\WD_Automation_EXPORT\WD_Automation\test-output\old\Default suite exists: true
[Utils] Attempting to create C:\Users\ng647f1\Desktop\Worspaces_Automation\WD_Automation\WD_Automation_EXPORT\WD_Automation\test-output\old\Default suite\methods-not-run.html
[Utils]   Directory C:\Users\ng647f1\Desktop\Worspaces_Automation\WD_Automation\WD_Automation_EXPORT\WD_Automation\test-output\old\Default suite exists: true
[Utils] Attempting to create C:\Users\ng647f1\Desktop\Worspaces_Automation\WD_Automation\WD_Automation_EXPORT\WD_Automation\test-output\old\Default suite\testng.xml.html
[Utils]   Directory C:\Users\ng647f1\Desktop\Worspaces_Automation\WD_Automation\WD_Automation_EXPORT\WD_Automation\test-output\old\Default suite exists: true
[Utils] Attempting to create C:\Users\ng647f1\Desktop\Worspaces_Automation\WD_Automation\WD_Automation_EXPORT\WD_Automation\test-output\old\index.html
[Utils]   Directory C:\Users\ng647f1\Desktop\Worspaces_Automation\WD_Automation\WD_Automation_EXPORT\WD_Automation\test-output\old exists: true
[TestNG] Time taken by org.testng.reporters.SuiteHTMLReporter@17550481: 102 ms
[Utils] Attempting to create C:\Users\ng647f1\Desktop\Worspaces_Automation\WD_Automation\WD_Automation_EXPORT\WD_Automation\test-output\testng-failed.xml
[Utils]   Directory C:\Users\ng647f1\Desktop\Worspaces_Automation\WD_Automation\WD_Automation_EXPORT\WD_Automation\test-output exists: true
[Utils] Attempting to create C:\Users\ng647f1\Desktop\Worspaces_Automation\WD_Automation\WD_Automation_EXPORT\WD_Automation\test-output\Default suite\testng-failed.xml
[Utils]   Directory C:\Users\ng647f1\Desktop\Worspaces_Automation\WD_Automation\WD_Automation_EXPORT\WD_Automation\test-output\Default suite exists: true
[TestNG] Time taken by [FailedReporter passed=0 failed=0 skipped=0]: 8 ms
[TestNG] Time taken by org.testng.reporters.XMLReporter@614c5515: 9 ms
[Utils] Attempting to create C:\Users\ng647f1\Desktop\Worspaces_Automation\WD_Automation\WD_Automation_EXPORT\WD_Automation\test-output\junitreports\TEST-selenium.SeleniumTest2.xml
[Utils]   Directory C:\Users\ng647f1\Desktop\Worspaces_Automation\WD_Automation\WD_Automation_EXPORT\WD_Automation\test-output\junitreports exists: true
[TestNG] Time taken by org.testng.reporters.JUnitReportReporter@4157f54e: 10 ms
[TestNG] Time taken by org.testng.reporters.jq.Main@1324409e: 55 ms
[TestNG] Time taken by org.testng.reporters.EmailableReporter2@6be46e8f: 11 ms

1 个答案:

答案 0 :(得分:0)

我对您的代码进行了3次更改:

1)我不明白lienTest所以我在java项目中创建了其他csv&gt; CSV&gt; testcase1.csv

2)我将“webdriver.firefox.marionette”更改为“webdriver.gecko.driver”

3)我改变了你的PSEUDO,MDP,CONNECT元素的XPATH 如下:

@FindBy(how = How.XPATH, using = "//*[@id='container']/div[1]/div[1]/div/div[2]/div/div[1]/div/div[1]/div[3]/div[1]/div/input")
public WebElement PSEUDO;

@FindBy(how = How.XPATH, using = "//*[@id='container']/div[1]/div[1]/div/div[2]/div/div[1]/div/div[1]/div[3]/div[2]/div/input")
public WebElement MDP;

@FindBy(how = How.CLASS_NAME, using = "//*[@id='container']/div[1]/div[1]/div/div[2]/div/div[1]/div/div[1]/button")
public WebElement CONNECT;

更新了SeleniumTest类的代码:

package selenium;
//import com.relevantcodes.extentreports.ExtentReports;
//import com.relevantcodes.extentreports.ExtentTest;
//import com.relevantcodes.extentreports.LogStatus;
import java.io.IOException;
import org.testng.annotations.Test;
//import org.testng.ITestResult;
//import org.testng.annotations.AfterMethod;
import org.testng.annotations.DataProvider;
import java.io.FileReader;
import java.util.List;
import com.opencsv.*;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.PageFactory;
import org.openqa.selenium.remote.DesiredCapabilities;
//import library.Utility;

public class SeleniumTest {

//ExtentReports report;
//ExtentTest logger;

private static WebDriver driver = null;

@DataProvider(name = "testPlan")
public Object[][] motCles() throws IOException {
      //Lecture du plan de test avec Open CSV
      CSVReader reader = new CSVReader(new FileReader("./csv/testplan.csv"), ';', '"', 1);
             int i = 0;
             List<String[]> allRows = reader.readAll();
             Object testPlan[][]= new Object[allRows.size()][3];
             for(String[] row : allRows){
                   testPlan[i][0] = row[0];
                   testPlan[i][1] = row[1];
                   testPlan[i][2] = row[2];
                   i++;
             }
             reader.close();
      return testPlan;
}


@Test(dataProvider = "testPlan")

public void testCas(String nomTest, String descTest, String descTest1) throws Exception {

        System.out.println(descTest1);
        //report = new ExtentReports("C:\\test-output\\SortieReport.html");

        //logger = report.startTest("Test de Report Celia");

        //Lecture du cas de test avec OpenCSV
        CSVReader reader = new CSVReader(new FileReader("./csv/testcase1.csv"), ';', '"', 1);

        //System.setProperty("webdriver.chrome.driver", "chromedriver.exe");
        //System.setProperty("webdriver.ie.driver", "IEDriverServer.exe");
        System.setProperty("webdriver.gecko.driver","C:\\Eclipse\\Selenium\\geckodriver.exe");

        int i = 0;
        int j = 0;

        System.out.println("###################################################");
        System.out.println("##### TEST : " + nomTest);
        System.out.println("##### DESCRIPTION : " + descTest);
        System.out.println("###################################################");

        List<String[]> allRows = reader.readAll();
        String testDescription[][]= new String[50][21];

        //Sélection du navigateur utilisé pour le test en cours. Ce navigateur est défini dans les cas de tests.
        DesiredCapabilities capabilities;
        capabilities = DesiredCapabilities.firefox();
        capabilities.setCapability("marionette", true);
        capabilities.setCapability("proxyType", "pac");
        capabilities.setCapability("acceptInsecureCerts", true);
        capabilities.setCapability("browser.private.browsing.autostart", true); 

        //System.out.println("Le fichier csv ressemble à : " + allRows);

        driver = new FirefoxDriver(capabilities);

        //On agrandit la fenêtre de test pour éviter les problèmes d'invisibilité d'éléments avec ChromeDriver.
        driver.manage().window().maximize();
        //On définit le temps d'attente avant qu'un cas de test tombe en erreur quand un élément n'est pas trouvé.
        driver.manage().timeouts().implicitlyWait(1000, TimeUnit.SECONDS);

        //On lit les paramètres du cas de test dans le fichier du plan de test
        for(String[] row : allRows){
              for(j = 0; j<=20; j++){
                     //System.out.println("Regarde mes lignes :"+row[j]);
                     testDescription[i][j] = row[j];
              }
              if (testDescription[i][0] != null) {
                     //On lance le cas de test
                     testEtape(testDescription[i][0], testDescription[i][1], testDescription[i][2], testDescription[i][3], testDescription[i][4], testDescription[i][5], testDescription[i][6], testDescription[i][7], testDescription[i][8], testDescription[i][9], testDescription[i][10], testDescription[i][11], testDescription[i][12], testDescription[i][13], testDescription[i][14], testDescription[i][15], testDescription[i][16], testDescription[i][17], testDescription[i][18], testDescription[i][19], testDescription[i][20]);
              }
              i++;
        }
        driver.quit();
        reader.close();     
}

//@AfterMethod
//public void tearDown(ITestResult result){
    //if(result.getStatus()==ITestResult.FAILURE){
    //  String screenshot_path=Utility.captureScreenshot(driver, result.getName());
    //  String image= logger.addScreenCapture(screenshot_path);
    //  logger.log(LogStatus.FAIL, "Title verification", image);
//  }
//  report.endTest(logger);
//  report.flush();
//  driver.get("C:\\test-output\\SortieReport.html");
//}



// Interprétation des mots-clés
public void testEtape(String motCle, String paramTest1, String paramTest2, String paramTest3, String paramTest4, String paramTest5, String paramTest6, String paramTest7, String paramTest8, String paramTest9, String paramTest10, String paramTest11, String paramTest12, String paramTest13, String paramTest14, String paramTest15, String paramTest16, String paramTest17, String paramTest18, String paramTest19, String paramTest20) throws Exception {    

    //On initialise les classes des pages avec PageFactory
    FindElements FindElements1 = PageFactory.initElements(driver, FindElements.class);

    //Pour chaque mot clé, des actions sont lancées. Certaines de ces actions sont des fonctions définies dans les classes des pages
    switch(motCle.toUpperCase()){ 
        case "ALLER":
            //logger.log(LogStatus.INFO, "Browser started ");
            System.out.println("Connexion au site : " + paramTest1);
            driver.get(paramTest1);
            driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
            //logger.log(LogStatus.INFO, "Application is up and running");
        break;
        case "CONNEXION":
             System.out.println("ICI REGARDE CELA : "+ paramTest1);
             System.out.println("ICI REGARDE CELA : "+ paramTest2);
             FindElements1.connexionWD(paramTest1, paramTest2);
             driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
             //logger.log(LogStatus.PASS, "Connexion verified");
        break;
        default :
             System.out.println("||||| Mot clé non trouvé : " + motCle.toUpperCase());  
    }

}

}