@Page("http://hackaday.com/blog/")
public class Hackaday {
@Page()
public static class Post{
@Selector(".entry-title") String title;
@Selector(".entry-date") String dateAsString;
Date date;
@AfterPageLoad
public void after() {
final DateFormat format = new SimpleDateFormat("MMMMM d, yyyy", Locale.US);
try {
this.date = format.parse(this.dateAsString);
} catch (final ParseException e) {
throw new RuntimeException(e);
}
}
}
@Selector("article")
public List<Post> posts;
public static void main(final String[] args) {
Browser
.get(Hackaday.class)
.posts
.forEach(p -> System.out.println(p.title+" : "+p.date));
}
}