<commit_before>package com.mycompany.client;

// Selenide
import com.codeborne.selenide.Selenide;
import com.codeborne.selenide.ElementsCollection;
import com.codeborne.selenide.SelenideElement;

// Java Collections
import java.util.Map;
import java.util.HashMap;

// Static methods
import static com.codeborne.selenide.Selenide.$;
import static com.codeborne.selenide.Selenide.$$;
import static com.codeborne.selenide.Selectors.byId;
import static com.codeborne.selenide.Condition.appears;
import static com.codeborne.selenide.WebDriverRunner.isJBrowser;

public class HomePage {

    private static final String PAGE_ID = "home-page";
    private static final int WAIT = 500;


    public HomePage() {
        $(byId(PAGE_ID)).waitUntil(appears, WAIT);
    }

    public SportsPage selectColor(String color) {

        SportsPage sportsPage = null;
        SelenideElement element = getButtonElement(color);

        if(element != null) {
            element.click(); 
            sportsPage = new SportsPage();   
        }

        return sportsPage;
    }

    public String getBackgroundColor(String color) {

        // JBrowser does not support returning attributes; Return input
        if(isJBrowser())
            return color;

        SelenideElement element = getButtonElement(color);
        
        return ( element != null ) ? getValueForStyle(element, "background-color") : "";
    }

    private SelenideElement getButtonElement(String color) {

        SelenideElement element = $(byId(PAGE_ID + "-" + color)).waitUntil(appears, WAIT);
        
        if(element != null && element.isDisplayed() == false)
            element = null;

        return element;
    }

    private String getValueForStyle(final SelenideElement element, final String property) {

        String style = element.attr("style");

        System.out.println("style: " + style);
        if(style == null || style.trim().length() == 0)
            return "";

        int indexOfProperty = style.indexOf(property);
        System.out.println("indexOfProperty: " + indexOfProperty);
        if(indexOfProperty == -1)
            return "";

        int indexOfSemicolon = style.indexOf(";", indexOfProperty);
        int indexOfValue = indexOfProperty + property.length() + 2;

        return style.substring(indexOfValue, indexOfSemicolon);

    }

    public boolean isDisplayed() {
        return $(byId(PAGE_ID)).isDisplayed();
    }

}<commit_msg>Remove leftover System print statements<commit_after>package com.mycompany.client;

// Selenide
import com.codeborne.selenide.Selenide;
import com.codeborne.selenide.ElementsCollection;
import com.codeborne.selenide.SelenideElement;

// Java Collections
import java.util.Map;
import java.util.HashMap;

// Static methods
import static com.codeborne.selenide.Selenide.$;
import static com.codeborne.selenide.Selenide.$$;
import static com.codeborne.selenide.Selectors.byId;
import static com.codeborne.selenide.Condition.appears;
import static com.codeborne.selenide.WebDriverRunner.isJBrowser;

public class HomePage {

    private static final String PAGE_ID = "home-page";
    private static final int WAIT = 500;


    public HomePage() {
        $(byId(PAGE_ID)).waitUntil(appears, WAIT);
    }

    public SportsPage selectColor(String color) {

        SportsPage sportsPage = null;
        SelenideElement element = getButtonElement(color);

        if(element != null) {
            element.click(); 
            sportsPage = new SportsPage();   
        }

        return sportsPage;
    }

    public String getBackgroundColor(String color) {

        // JBrowser does not support returning attributes; Return input
        if(isJBrowser())
            return color;

        SelenideElement element = getButtonElement(color);
        
        return ( element != null ) ? getValueForStyle(element, "background-color") : "";
    }

    private SelenideElement getButtonElement(String color) {

        SelenideElement element = $(byId(PAGE_ID + "-" + color)).waitUntil(appears, WAIT);
        
        if(element != null && element.isDisplayed() == false)
            element = null;

        return element;
    }

    private String getValueForStyle(final SelenideElement element, final String property) {

        String style = element.attr("style");

        if(style == null || style.trim().length() == 0)
            return "";

        int indexOfProperty = style.indexOf(property);
        if(indexOfProperty == -1)
            return "";

        int indexOfSemicolon = style.indexOf(";", indexOfProperty);
        int indexOfValue = indexOfProperty + property.length() + 2;

        return style.substring(indexOfValue, indexOfSemicolon);

    }

    public boolean isDisplayed() {
        return $(byId(PAGE_ID)).isDisplayed();
    }

}
{'fraction_non_alphanumeric': 0.10657785179017486, 'fraction_numerical': 0.002497918401332223, 'mean_word_length': 2.8781275221953186, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1692501', 'n_tokens_mistral': 1375, 'n_tokens_neox': 1323, 'n_words': 304}