Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6622161
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:22:15+00:00 2026-05-25T21:22:15+00:00

I am Using Selenium RC with TestNG to do some kind of keyword driven

  • 0

I am Using Selenium RC with TestNG to do some kind of keyword driven testing.For the same purpose i want to read some data from an excel sheet and use it.Here I have used Data Provider annotation of TestNG.but My problem is that i want to read data from multiple tables and use them in a single test method using only one data provider.But I am Getting Problem in it.Can somebody Help me in Doing so.

Thanks

Here Is my Code:

@DataProvider(name = "DP1")

public Object[][] createData1() throws Exception {

  return new Object[][] {

    {getTableData.getTableArray(" Xls File Path", "Sheet name", "Table1")},

    {getTableData.getTableArray(" Xls File Path", "Sheet name", "Table2")}

  };

}

This Is My Test Method:

@Test (dataProvider = ("DP1"))

public void testallpivot(String Command, String Target, String Value) throws Exception {

  //Test Code here


}

But This Code is Showing Array Index Out of Bound Exception..
Somebody Please Help me…..

Well this is how getTableArray looks..

public static Object[][] getTableArray(String xlFilePath, String sheetName, String     tableName) throws Exception{
    Object[][] tabArray;

        Workbook workbook = Workbook.getWorkbook(new File(xlFilePath));
        Sheet sheet = workbook.getSheet(sheetName); 
        int startRow,startCol, endRow, endCol,ci,cj;
        Cell tableStart=sheet.findCell(tableName);
        //System.out.println(tableName);
        startRow=tableStart.getRow();
        startCol=tableStart.getColumn();

        Cell tableEnd= sheet.findCell(tableName, startCol+1,startRow+1, 100, 64000,  false);                

        endRow=tableEnd.getRow();
        endCol=tableEnd.getColumn();
        System.out.println("startRow="+startRow+", endRow="+endRow+", " +
                "startCol="+startCol+", endCol="+endCol);
        tabArray=new String[endRow-startRow-1][endCol-startCol-1];
        ci=0;

        for (int i=startRow+1;i<endRow;i++,ci++){
            cj=0;
            for (int j=startCol+1;j<endCol;j++,cj++){
                tabArray[ci][cj]=sheet.getCell(j,i).getContents();
            }
        }


    return(tabArray);
}

And this is the Stack Trace…..

java.lang.ArrayIndexOutOfBoundsException: 1
at org.testng.internal.Invoker.injectParameters(Invoker.java:1144)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1020)
atorg.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:137)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:121)
at org.testng.TestRunner.runWorkers(TestRunner.java:953)
at org.testng.TestRunner.privateRun(TestRunner.java:633)
at org.testng.TestRunner.run(TestRunner.java:505)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:359)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:354)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:316)
at org.testng.SuiteRunner.run(SuiteRunner.java:195)
at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:903)
at org.testng.TestNG.runSuitesLocally(TestNG.java:872)
at org.testng.TestNG.run(TestNG.java:780)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:75)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:127)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T21:22:15+00:00Added an answer on May 25, 2026 at 9:22 pm

    We can’t help you much if you don’t include the stack trace and also what getTableArray() returns (it should be Object[]).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been using selenium IDE to do some web app testing. I have
I'm testing a web page using selenium. I want to get all the 'leaf
I'm using Selenium in C# with Selenium RC to do some automated interaction testing
I'm a Perl programmer doing some web application testing using Selenium . I was
The company I'm currently working for is using Selenium for Uniting-Testing our User Interface.
We've been using selenium with great success to handle high-level website testing (in addition
I'm using selenium to run some functional tests on the UI for our current
I am writing some UI tests using Selenium and i have a JavaScript Tree
I'm building some functional tests for a web site using Selenium, and I'm stuck
I am currently investigating using the selenium-on-rails plug-in for testing an upcoming web app

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.