title: How to save data into a file using Selenium
body: <pre><code>public static void main(String[] args) throws IOException {
  
      System.setProperty("src/driver/chromedriver", "G:\\chromedriver.exe");
      WebDriver driver = new ChromeDriver();
      driver.get("https://www.premierleague.com/tables");
  
      WebElement table;
  
      table = driver.findElement(By.xpath("//*[@id=\"mainContent\"]/div/div[1]/div[3]/div/div"));
      String dataoutput;
      dataoutput = table.getText();
      System.out.println(dataoutput);
  
      String csvOutputFile = "table.csv";
  
      File filedata = new File("src/main/table.csv");
      if (filedata.exists() &amp;&amp; !filedata.isFile()) {
          FileWriter writecsv = new FileWriter("src/main/table.csv");
          String datas = dataoutput;
          writecsv.append(dataoutput)
      }
  }
  </code></pre>
  
  <p>This is my code but it isn't saving data to file.</p>