Page object Class got more methods

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Page object Class got more methods

kingarasan
Hi,

I developed my selenium testing after looking into your page object designed pattern training. It was really helpful. Thanks for posting it

I have written Page object class for Login page to test UI look & feel for web, iphone & tablet. For each verification I have written a method to return cssValue or text for that element.  

Writing that increases lot method defined in a single class. Is there any way to reduce no of methods declared in a page object class?

Example:

    public String getBannerCssValue(String cssValue){
        return getCssValue(driver.findElement(banner), cssValue);
    }

    public String getSmartPhoneLegendText(){
        return getElementText(driver.findElement(smartPhoneLegend));
    }

    public String getSmartPhoneLegendCssValue(String cssValue){
        return getCssValue(driver.findElement(smartPhoneLegend), cssValue);
    }

    public String getTabletLegendText(){
        return getElementText(driver.findElement(tabletLegend));
    }

    public String getTabletLegendCssValue(String cssValue){
        return getCssValue(driver.findElement(tabletLegend), cssValue);
    }

    public String getButtonTextValue(){
        return getAttribute(driver.findElement(login), "value");
    }

    public String getSubmitButtonCssValue(String cssValue){
        return getCssValue(driver.findElement(login), cssValue);
    }

    public String getForgotPasswordCssValue(String cssValue){
        return getCssValue(driver.findElement(forgotYourPassword), cssValue);
    }

    public String getTabButtonTextValue(){
        return getAttribute(driver.findElement(tabletSubmit), "value");
    }