Copy content from WEB page

0

I'm not sure if my question is pertinent to the forum, but since I did not find anything related to this, I believe that someone can give me the help in this need, my need is to copy the contents of a web page, which according to the% selected% shows the contents, they are n Dropdown my need would be to copy all the contents of that page.
Is this possible? If my question is not pertinent to the community, I apologize.

    
asked by anonymous 07.11.2017 / 12:13

1 answer

2

I have the following code to solve my need:

URL url = null;
File file = new File("C:\Backup\page.html");
BufferedWriter outFile = new BufferedWriter(new FileWriter(file));
def x = 1;
url = new URL("http://site");

BufferedReader inFile = new BufferedReader(new InputStreamReader(url.openStream()));
String inputLine;

while ((inputLine = inFile.readLine()) != null) {
    logger.info(inputLine.toString())
    outFile.write(inputLine);
    outFile.newLine();
}
logger.info("RAMO: "+x.toString())
x++

inFile.close();
outFile.flush();
outFile.close();

I hope this helps the next.

    
07.11.2017 / 12:49