Created
June 15, 2014 04:23
-
-
Save beothorn/cc945dbea51d1c200617 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import webGrude.annotations.Page; | |
import webGrude.annotations.Selector; | |
import java.util.List; | |
public class PrintExampleSearchResults { | |
@Selector("") | |
public static class SearchResult{ | |
@Selector(".result-title") public String resultTitle; | |
@Selector(".result-content") public String resultContent; | |
} | |
@Page("http://www.example.com/{0}") | |
public static class SearchResultPage { | |
@Selector("h1") public String header; | |
@Selector(".result") public List<SearchResult> searchResults; | |
} | |
public static void main(String... args){ | |
SearchResultPage searchPage = Browser.open(SearchResultPage.class, "search term"); | |
System.out.println(searchPage.header); | |
searchPage.searchResults.forEach(result -> | |
System.out.println("Title: "+result.resultTitle+"\n Content: "+result.resultContent) | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment