<commit_before>package org.jbehave.web.examples.trader.webdriver.pages;

import org.jbehave.web.webdriver.WebDriverFactory;
import org.openqa.selenium.By;
import org.openqa.selenium.support.ui.Select;

import java.util.List;

import static junit.framework.Assert.assertTrue;

public class FindSteps extends TraderPage {

    public FindSteps(WebDriverFactory driver) {
        super(driver);
    }

    public void find(String step) {
        findElement(By.name("matchingStep")).sendKeys(step);
        findElement(By.name("findButton")).click();
    }

    public void found(String step) {
        getPageSource().contains(step);
    }

    public void found(List<String> steps) {
        String pageSource = getPageSource();
        for ( String step : steps ){
            assertTrue(pageSource.contains(step));
        }
    }

    public void viewWithMethods() {
        Select dropDown = new Select(findElement(By.name("viewSelect")));
        dropDown.selectByVisibleText("WITH_METHODS");
    }

    public void sortByPattern() {
        Select dropDown = new Select(findElement(By.name("sortingSelect")));
        dropDown.selectByVisibleText("BY_PATTERN");
    }

}<commit_msg>JBEHAVE-345: must escape < and > for in-page search<commit_after>package org.jbehave.web.examples.trader.webdriver.pages;

import org.jbehave.web.webdriver.WebDriverFactory;
import org.openqa.selenium.By;
import org.openqa.selenium.support.ui.Select;

import java.util.List;

import static org.junit.Assert.fail;

public class FindSteps extends TraderPage {

    public FindSteps(WebDriverFactory driver) {
        super(driver);
    }

    public void find(String step) {
        findElement(By.name("matchingStep")).sendKeys(step);
        findElement(By.name("findButton")).click();
    }

    public void found(String step) {
        found(getPageSource(), step);
    }

    public void found(List<String> steps) {
        String pageSource = getPageSource();
        for (String step : steps) {
            found(pageSource, step);
        }
    }

    private void found(String pageSource, String step) {
        if (!pageSource.contains(escapeToHtml(step))) {
            fail("Step:**" + step + "** not found in page **" + pageSource + "**");
        }
    }

    private String escapeToHtml(String step) {
        return step.replace("<", "&lt;").replace(">", "&gt;");
    }

    public void viewWithMethods() {
        new Select(findElement(By.name("viewSelect"))).selectByVisibleText("WITH_METHODS");
    }

    public void sortByPattern() {
        new Select(findElement(By.name("sortingSelect"))).selectByVisibleText("BY_PATTERN");
    }

}
{'fraction_non_alphanumeric': 0.12982588947766843, 'fraction_numerical': 0.0011355034065102195, 'mean_word_length': 3.2288, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '6102448', 'n_tokens_mistral': 807, 'n_tokens_neox': 784, 'n_words': 147}