Micro Focus QTP (UFT) Forums
Facing issue with Java Table to press Enter Key from Keyboard - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: Facing issue with Java Table to press Enter Key from Keyboard (/Thread-Facing-issue-with-Java-Table-to-press-Enter-Key-from-Keyboard)



Facing issue with Java Table to press Enter Key from Keyboard - Nasir Ahmed - 05-23-2014

Hi,
We have Java Application in which we have to enter the data in Java tables. Some Java tables are visible and some are not visible to naked eye as the scroll down operation is required to make them visible.
Each Java table is designed in a way that row will created dynamically by pressing the Enter key from Keyboard. The Script is working fine for the java tables which are visible to naked eye. To add new row to a java table which is not visible to naked eye first scroll down needs to be done to make the java table visible. Then Select cell in order to press Enter Key from Keyboard. While performing Select cell operation the Scroll will move upwards by itself making the java table as invisible. Hence the QTP will execute the entire script without creating new row. If we make the scroll down also then we have to select and then press enter, again it scrolls up. Hence we require help to solve this query as we are stuck and we can’t move forward.

We had tried the option which are provided in help file.However we are not succeeded to meet the expectation. The options are mentioned below.
 Activate Cell/Row/Column provided in QTP
 Set Cell provided in QTP
 Click Cell/Double Click Cell provided in QTP
 Send Keys from Shell Object
 Fire Event provided in QTP

We noticed that if we perform the methods provided by QTP on Java table then the scroll will automatically move up to the default position.


‘’’The Block of code will Iterate the loop in order to find non empty cell in excel sheet
Code:
For intRow=3 to intRowCount
intAppRowCounter=0
           For intColumn =1  to  intAppColCount
        strCellData= get the data from Excel sheet
        If strCellData= EMPTY  Then
              intAppRowCounter=  intAppRowCounter+1
        End If
         Next
‘This block of code perfrom Keyboard operation such as Press Enter
Code:
If   intAppRowCounter=0 Then
        Set objWshShell = CreateObject("WScript.Shell")      
        objJavaTable.SelectCell strRow,strColumn
        objWshShell.SendKeys "{ENTER}"  
    End If
    Next