Welcome, Guest. Please login or register.
Login with username, password and session length

 
Advanced search

18120 Posts in 4741 Topics- by 31743 Members - Latest Member: suuraj
 

Pages: [1]   Go Down
Print
0 Members and 1 Guest are viewing this topic.
Author Topic: Right Clicking and selecting an option    (Read 423 times)
Sayan Sarkar
User
*
Offline Offline

Posts: 27


« on: November 26, 2009, 06:02:44 AM »

Hi,

I am working with QTP 10.0 and automating a Java Application. I am not being able to find out a way by which I can right-click and select an option. Please find the details of the situation mentioned below:

Sample Hierarchy: Javawindow("Java").Javatab("javatab").KTable("Test")

Now, in the ktable, there are say 100 rows each with a unique data. I need to search for the row number using the unique data and then select that data, right-click the data id, and select a specific option from the ones available. I am able to search the row id successfully and selecting the same. But, how to right-click the selection and selecting an option?

Please note that the mouse pointer is/ might be at a different location when I am selecting the searched row id. How to right-click on the selection?

Please help me out with your valuable suggestions.
Logged
Meir Bar-Tal
Administrator
Advanced User
*****
Offline Offline

Posts: 1283



WWW
« Reply #1 on: December 02, 2009, 11:10:01 PM »

First, please search the web to learn more about KTable object model (a good starting point could be this link[/url).

To your question, there are at least 2 approaches available:
1) Use the ClickCell(row, col, mouse_button, modifier) method - As with a regular JTable.
2) Use the Mercury.DeviceReplay to send a mouse event after getting the appropriate coordinates based on the index of the selected row and the height of a table row.
Code
GeSHi (qtp):
Function ClickCell(ByVal intRowId,  ByVal intColId, ByVal intMouseButton, ByVal intModifier)

    Dim dr, objPoint



    Set dr = CreateObject("Mercury.DeviceReplay")

    Set objPoint = New Point 'a custom class (data structure) with two public members X and Y



   'TODO: Implement the code to get the coordinates of the selected row at the mid of the cell on which to do the mouse click



    With dr

        If IsNumeric(intModifier) Then .KeyDown intModifier

        .MouseClick objPoint.X, objPoint.Y, intMouseButton

        If IsNumeric(intModifier) Then .KeyUp intModifier

    End With



    Set dr = Nothing

    Set objPoint = Nothing

End Function

 
Created by GeSHI 1.0.7.20

You can learn more about the DeviceReplay object here
Logged

Best Regards,

Meir Bar-Tal
AdvancedQTP Chief Editor & Forums Administrator
Pages: [1]   Go Up
Print
Jump to: