All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.sdl.selenium.extjs3.grid.GridRow Maven / Gradle / Ivy

Go to download

Automated Acceptance Testing. Selenium and Selenium WebDriver test framework for web applications. (optimized for dynamic html, ExtJS, Bootstrap, complex UI, simple web applications/sites)

The newest version!
package com.sdl.selenium.extjs3.grid;

import com.sdl.selenium.web.SearchType;
import com.sdl.selenium.web.WebLocator;
import com.sdl.selenium.web.table.AbstractCell;
import com.sdl.selenium.web.table.AbstractRow;
import com.sdl.selenium.web.table.Cell;
import com.sdl.selenium.web.table.ICell;

public class GridRow extends AbstractRow {

    public GridRow() {
        setRenderMillis(200);
        setClassName("GridRow");
        setTag("*");
    }

    //TODO generated standard xpath  independent of constructors
    public GridRow(GridPanel gridPanel) {
        this();
        setContainer(gridPanel);
        setTag("div");
        setClasses("x-grid3-row");
        setExcludeClasses("x-grid3-row-checker");
    }

    public GridRow(GridPanel gridPanel, int rowIndex) {
        setContainer(gridPanel);
        setTag("div[" + rowIndex + "]");
        setClasses("x-grid3-row");
        setExcludeClasses("x-grid3-row-checker");
    }

    public GridRow(GridPanel gridPanel, int searchColumnIndex, String searchElement, SearchType... searchTypes) {
        this(gridPanel, new GridCell(searchColumnIndex, searchElement, searchTypes));
    }

    public GridRow(GridPanel gridPanel, String searchColumnId, String searchElement, SearchType... searchTypes) {
        this(gridPanel);
        setTag("*");
        WebLocator cellEl = new WebLocator().setText(searchElement, searchTypes);
        setElPath("//" + getPathBuilder().getTag() + "[" + getSearchPaths(searchColumnId, cellEl) + "]");
    }

    public GridRow(GridPanel gridPanel, AbstractCell... cells) {
        this(gridPanel);
        setTag("*");
        setChildNodes(cells);
    }

    private String getSearchPaths(String searchColumnId, WebLocator cellEl) {
        return "count(*[contains(@class, 'x-grid3-row-table')]//*[contains(@class, 'x-grid3-td-" + searchColumnId + "')]" + cellEl.getXPath() + ") > 0";
    }

    public GridRow(GridPanel gridPanel, int rowIndex, boolean isSelected) {
        this(gridPanel, rowIndex);
        if (isSelected) {
            setTag("div[" + rowIndex + "]");
            setClasses("x-grid3-row-selected");
            setExcludeClasses("x-grid3-row-checker");
        }
    }

    @Override
    public ICell getCell(int columnIndex) {
        return new Cell(this, columnIndex);
    }

    @Override
    public int getCells() {
        return new Cell(this).size();
    }

    @Override
    public int getHeadersCount() {
        return 0;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy