selenium chromedriver - Not able to Run script, Error with parameter in TestNG, -


i trying execute script login webpage.can any1 me solve dis problem?

i getting below error:-

the data provider trying pass 7 parameters method
efgh.datadriven#login takes 2

public class datadriven {      public webdriver driver;      @test(dataprovider ="testdata")     public void login(string username, string password){          driver=new chromedriver();         driver.get("https://pos.lycamobile.es/login/login.aspx?lang=es");         driver.findelement(by.name("username")).sendkeys(username);         driver.findelement(by.name("password")).sendkeys(password);         driver.close();     }      @dataprovider(name = "testdata")     public object [] [] readexcel() throws biffexception, ioexception {         file f =new file("d:\\users\\sarsiddi\\documents\\datasheet.xls");        workbook w = workbook.getworkbook(f);        sheet s= w.getsheet("lycadata");         int rows = s.getrows();        int columns = s.getcolumns();       // system.out.println(rows);      // system.out.println(columns);             string inputdata[] [] = new string [rows] [columns];         (int i=0; i<rows; i++){             (int j=0; j<columns; j++){                 cell c = s.getcell(j, i);                 inputdata [i][j] = c.getcontents();                 //system.out.println(inputdata[i][j]);             }              }         return inputdata;     } } 

your dataprovider wants give 7 parameters test, login takes 2.

to fix there 2 options.

  1. add 7 parameters login method. have username , pw

  2. return 2 parameters dataprovider.

if plan use 2 parameters in test then, remove other parameters excel sheet. or create sheet login only.


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -