JAva: why isn't anything being written to my txt file?
<pre><code>public static void getMembers(WebDriver driver, String outname){

    FileWriter outFile = null;
    try {
        outFile = new FileWriter(new File("myfile.txt"));
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    //continue from 900
    for(int i=1;i&lt;=5070;i++){
        driver.get("/username&amp;page="+i);

        List&lt;WebElement&gt; links = driver.findElements(By.xpath("/html/body/div[2]/div/div/form/table[2]/tbody/tr/td/a"));
        for(WebElement link : links){

            if (link.getText() == ""){                  
            }else{
            try {
                outFile.write(link.getText() + "\n");
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            System.out.println(link.getText());
            }
        }

    }
}
</code></pre>

<p>System.out.println(link.getText()); spits out the appropriate strings....however myfile.txt is empty !</p>
