Hire QA – Specialized in QA Recruitment, Technical Interviews and Testing Solutions

How to extract text from a web page using selenium and save it as a text file

Category: Selenium WebDriver

String output = driver.findElement(By.xpath(“/html/body/div[1]/div[5]/div/div/div[1]/div[2]/div[1]/div”)).getText();
File DestFile= new File(“extractedFilePath”);
FileUtils.writeStringToFile(DestFile, output);

Leave a Reply

Your email address will not be published. Required fields are marked *