use of it.vige.rubia.model.Category in project rubia-forums by flashboss.
the class ViewRSSLink method getPage.
public static Topic getPage(WebDriver driver, Topic topic) {
VerifyTopic.goTo(driver, topic);
goTo(driver);
Topic result = new Topic();
result.setSubject(driver.findElement(id(FEED_TITLE_TEXT)).getText().split(": ")[1]);
String[] splittedText = driver.findElement(id(FEED_SUBTITLE_TEXT)).getText().split(" in topic | in forum | in category ");
result.setForum(new Forum(splittedText[2]));
result.getForum().setCategory(new Category(splittedText[3]));
List<Post> posts = new ArrayList<Post>();
List<WebElement> entries = driver.findElements(className(ENTRY_LINK));
DateFormat dateFormat = new SimpleDateFormat("d MMM yyyy, HH:mm");
for (WebElement entry : entries) {
String[] entryText = entry.getText().split(BY);
String lastUpdated = entry.findElement(className(LAST_UPDATED)).getText();
Post post = new Post(entryText[0]);
post.setPoster(new Poster(entryText[1].split("\n")[0]));
try {
post.setCreateDate(dateFormat.parse(lastUpdated));
} catch (ParseException e) {
}
post.setMessage(new Message(entry.findElement(className(FEED_ENTRY_CONTENT)).getText()));
post.getMessage().setSubject(entryText[0]);
posts.add(post);
}
result.setPosts(posts);
returnToHome(driver);
return result;
}
Aggregations