Using Java variables with Sikuli in Selenium-Webdriver

Asked by Sama

/* The code below is a Java code in selenium webdriver. The code reads a long list from an excel sheet.
       It stores the values in each excel cell in variables, LastName and FirstName.
        I need to use the variables in a query, after navigating to SQL Server management studio database.
        This is where am having issues. when I use the command 'screen.type(LastName);'
        The variable LastName throws cannot be resolved to a variable error

  QUESTION. How do I use the variables LastName and FirstName defined in Java in Sikuli.

HELP PLEASE!
*/

 File src = new File ("C:\\EmployeeList.xlsx");
 FileInputStream fis = new FileInputStream(src);
 XSSFWorkbook wb = new XSSFWorkbook(fis);
 XSSFSheet sheet1 = wb.getSheetAt(0);
 int rowcount=sheet1.getLastRowNum();
 System.out.println("Total Row is :" + rowcount);

 for (int i=0; i<rowcount;i++)
 {
 String LastName=sheet1.getRow(i).getCell(0).getStringCellValue();
 String FirstName=sheet1.getRow(i).getCell(1).getStringCellValue();
 System.out.println("Data Employee List is " +i+ " "+"is "+ LastName+ ", "+FirstName+");
 }
 wb.close();

 //Navigated into SQL Server management studio database
   screen.type(LastName);

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

--- The variable LastName throws cannot be resolved to a variable error
please post the original error/exception message

Revision history for this message
Sama (sama8080) said :
#2

screen.type(LastName);
LastName is underlined red in Eclipse. When I put the cursor on it, it reads 'LastName cannot be resolved to a variable'

Revision history for this message
RaiMan (raimund-hocke) said :
#3

has nothing to do with Sikuli.
A Java programming challenge ;-)

Check your setup:
I guess you need some import or additional code, to make LastName a defined variable.

Can you help with this problem?

Provide an answer of your own, or ask Sama for more information if necessary.

To post a message you must log in.