hsac-fitnesse-fixtures icon indicating copy to clipboard operation
hsac-fitnesse-fixtures copied to clipboard

How to double click a cell in the table?

Open rainman-ph opened this issue 5 years ago • 3 comments

I'm trying to implement a double click in table cell given the row index and column name.

    public boolean doubleClickInRowNumber(String requestedColumnName, int rowIndex) {
        By rowBy = GridBy.rowNumber(rowIndex);
        // how to get the place given the rowBy?
        return doubleClick(place);
    }

rainman-ph avatar Nov 04 '18 14:11 rainman-ph

if you are looking to get similar behaviour as clickInRowNumber() I suggest you solve the problem similar to clickInRow():

    protected boolean doubleClickInRow(By rowBy, String place) {
        return Boolean.TRUE.equals(doInContainer(() -> findElement(rowBy), () -> doubleClick(place)));
    }

This way the 'normal' heuristics will be applied to find the clickable element in the row.

Unfortunately that does not (if I recall correctly) allow you to click on whatever is the content of the cell in the column with the given header. The 'place' must really be present in the cell (the column's header is not considered).

One of the hardest, for me, things to get right when working with xpath is translating a column header to column index inside an xpath, which is what one needs to find a cell in a row.

fhoeben avatar Nov 04 '18 15:11 fhoeben

The GridBy class does allow you to get a cell in a row based on its column header: columnInRow(String requestedColumnName, int rowIndex), but that gets the cell not an element to click inside it. So a combination of that (to get a search context) and another by to get the actual element to click should get the job done...

fhoeben avatar Nov 04 '18 15:11 fhoeben

Thanks @fhoeben , I will look into that and post back my updates here later.

rainman-ph avatar Nov 07 '18 03:11 rainman-ph