Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Experience with Google Java API?

Erwin Heil
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Need somebody with experiences with the Java API from Google.
I use the API to get an easy access to the Google Webservice.
Everything works accept the use of GoogleSearchResultElement!
How can I use e.g. getTitle() or getSnippet()? While calling these methods I get no result..
code snippet:
GoogleSearch s = new GoogleSearch();
if (directive.equalsIgnoreCase("Search")){
// Invoking GoogleSearch
GoogleSearchResult r = s.doSearch();
System.out.println("Google Search Results:");
// here it comes...
GoogleSearchResultElement gsre = new GoogleSearchResultElement();
String st = gsre.getTitle();
String sn = gsre.getSnippet();
System.out.println("Title: "+st+" | Snippet: "+sn); //[IS NOT THERE!]
// Output [IS THERE!]
result = r.toString();
cheers, erwin
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic