How to select a row from a set of multiple rows from a list.

Hi All,

I’m a novice to Eggplant and need help for an application i’m working on.

In my application, there is a list whose each row contains a checkbox, two buttons and a slider. The rows number in the list varies according to the users wish. Initially when the application is launched, the list is empty. He/she can either add, edit or delete the rows from the list(options present for that).

But how can i select a particular row for performing these funtionalities. :!:

Help me in this regard. Also, please provide the sample code for the same.

Thanks & Regards,

Usually, each row will have a unique identifier that you can capture that will allow you to select each row.

Click "imageRow1"
Click "imageRow2"


Clicking on specific controls then, can be done by restricting the search rectangle.

On the other hand, you can also use coordinate based mechanics to select the appropriate row. Let’s say for instance that you had captured an image of a column heading. If the height of each row will be the same, you can use a coordinate offset to click on the approprite row.

// get the coordinates of a column heading (x,y)
put imagelocation("columnHeading1") into coord

// let's say the offset of each row (height) is 20
// to click on row 3 
Click (item 1 of coord, item 2 of coord + 20 * 3)

Thanks for the help.

But i’m facing a problem with the functions given in the mentioned link.

To use those functions i need to capture the images to set the coordinates, but i’m not understanding which images to capture and how will it take the image coordinates for setting the search rectangle??? :?:

Presumably the items in your list are each identified by a different text label. If you capture an image of the text then you can search for that to locate the correct row. The imageLocation() function can be used to get the coordinates of the image’s HotSpot and you can calculate the coordinates of the corners of your searchRectangle from there.

The script to do this might look something like this:

put imageLocation("textLabelImage") into rowLocation
set topLeft to rowLocation - (100,10)
set bottomRight to rowLocation + (250,20)
setSearchRectangle (topLeft, bottomRight)
click "checkBox"
setSearchRectangle -- restore to full screen

Perhaps that will help get you started. You’ll probably have to experiment to determine the actual offsets to use from the rowLocation coordinate. One way to do this is to set a breakpoint at that point in your script and then try typing some different MoveTo commands in the Do box to reposition the remote cursor. For example you could type “MoveTo rowLocation - (50,10)” and see where the cursor goes, then repeat with different offset values until you find the appropriate offsets for the rectangle you need.