Data Record in different pages
Hi All,
I need once again small help from u gr8 guys:
I have set screen scrapper successfully to scrape a site a small prob is
site first display list of articles with
"TITLE" and "SUMMARY" on one page and on click of one title it display the detail article,title,author,wordcount etc on this page i can extract these article fields by creating the datarecord easily but i am left with summary field which is displayed on previous page.
How to tackle this problem,How to get in summary field in datarecord Please help.
Thanks
Thanks Todd
Thanks very much todd it worked but waht i feel the software is nice but sometime one get stuck to where to place the extractor pattern in loop.
Data Record in different pages
Hi,
Assuming you're saving the article summary in a session variable called "summary", then the code would work fine. That is, you'd need to have an extractor pattern containing the following extractor pattern token: ~@summary@~. You'd need to edit that token, and check the box labeled "Save in session variable?" Assuming you've done all of that, the following code would do the trick:
out.write("\"" + dataRecord.get( "Art_Title" ) + "\"" + "," );
out.write("\"" + dataRecord.get( "Main_Cat" ) + "\"" + "," );
out.write("\"" + dataRecord.get( "Sub_Cat" ) + "\"" + "," );
out.write("\"" + dataRecord.get( "Author" ) + "\"" + "," );
out.write("\"" + dataRecord.get( "Word_Count" ) + "\"" + "," );
out.write("\"" + session.getVariable( "summary" ) + "\"" + "," );
Kind regards,
Todd
Write session variable
Hi Todd,
Thanks for ur reply,but i am writing the data in csv file like that:
out.write("\"" + dataRecord.get( "Art_Title" ) + "\"" + "," );
out.write("\"" + dataRecord.get( "Main_Cat" ) + "\"" + "," );
out.write("\"" + dataRecord.get( "Sub_Cat" ) + "\"" + "," );
out.write("\"" + dataRecord.get( "Author" ) + "\"" + "," );
out.write("\"" + dataRecord.get( "Word_Count" ) + "\"" + "," );
I have saved summary in session but am unable to write summary like u told in previous response thru this line:
out.write("\"" + session.getVariable( "summary" ) + "\"" + "," );
Thanks todd for ur help;
Data Record in different pages
Hi,
The easiest way would probably be to extract the summary from the previous screen, then store it in a session variable. Then, in your script that writes the data to a file, rather than referencing the summary like this:
dataRecord.get( "SUMMARY" );
You'd do it like this:
session.getVariable( "SUMMARY" );
Kind regards,
Todd Wilson