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

com.nordstrom.automation.selenium.examples.TableRowComponent Maven / Gradle / Ivy

Go to download

Selenium Foundation is an automation framework designed to extend and enhance the capabilities provided by Selenium (WebDriver).

There is a newer version: 28.3.1-s4
Show newest version
package com.nordstrom.automation.selenium.examples;

import java.util.Arrays;
import java.util.List;

import org.openqa.selenium.By;
import org.openqa.selenium.SearchContext;
import org.openqa.selenium.WebElement;

import com.nordstrom.automation.selenium.model.ComponentContainer;
import com.nordstrom.automation.selenium.model.PageComponent;
import com.nordstrom.automation.selenium.model.RobustWebElement;

public class TableRowComponent extends PageComponent {

    public TableRowComponent(By locator, ComponentContainer parent) {
        super(locator, parent);
    }
    
    public TableRowComponent(RobustWebElement element, ComponentContainer parent) {
        super(element, parent);
    }
    
    protected enum Using implements ByEnum {
        TBL_CELL(By.cssSelector("th,td"));
        
        private final By locator;
        
        Using(By locator) {
            this.locator = locator;
        }

        @Override
        public By locator() {
            return locator;
        }
    }
    
    private List cells;
    private int refreshCount;
    
    public List getContent() {
        List cells = getCells();
        return Arrays.asList(cells.get(0).getText(), cells.get(1).getText(), cells.get(2).getText());
    }
    
    private List getCells() {
        if (cells == null) {
            cells = findElements(Using.TBL_CELL);
        }
        return cells;
    }
    
    @Override
    public SearchContext refreshContext(long expiration) {
        refreshCount++;
        return super.refreshContext(expiration);
    }
    
    public int getRefreshCount() {
        return refreshCount;
    }
    
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy