0

i am using selenium or webBrowser to navigate the web url. the weburl downloaded the txt file. instead of downloading a file i want the file data in a variable. Can anybody please help in this.

for eq url is "https://trends.google.com/trends/api/explore?hl=en-US&tz=-330&req=%7B%22comparisonItem%22:%5B%7B%22keyword%22:%22tsla%22,%22geo%22:%22US%22,%22time%22:%22today+1-m%22%7D,%7B%22keyword%22:%22bitcoin%22,%22geo%22:%22US%22,%22time%22:%22today+1-m%22%7D%5D,%22category%22:0,%22property%22:%22%22%7D&tz=-330"

code snippet :

tcs = new TaskCompletionSource<bool>();
wb.DocumentCompleted += documentCompletedHandler;
try
{
    wb.Navigate(url.ToString());
    // await for DocumentCompleted
    await tcs.Task;   ----> here adownloaded a file but i want the file data;
}
finally
{
    wb.DocumentCompleted -= documentCompletedHandler;
}
SiKing
  • 10,003
  • 10
  • 39
  • 90
anu
  • 21
  • 3
  • Does this answer your question? [Reading a plain text file in Java](https://stackoverflow.com/questions/4716503/reading-a-plain-text-file-in-java) – SiKing Jun 15 '21 at 22:04
  • no. in my case i want to avoid downloading or saving a file . i just want the file data only. – anu Jun 15 '21 at 22:07
  • I think even if you stream the file, it will still be cached (temporarily stored) on disk. – SiKing Jun 16 '21 at 15:57

0 Answers0