I've got a problem writing a test using Webdriver and HTMLUnit for my Primefaces page.
What I've done is to add a simple Primefaces fileupload to the page, which will take a CSV file (no validation as yet), like this:
<p:fileUpload id="listFileUpload" mode="simple" value="#{fileImportView.file}" />
This will indeed make an UploadedFile object available to my listener method when used from Firefox.
However, when the same listener is called through the test the resulting UploadedFile is null. To give the fileupload field a value before submitting the form, I use sendKeys like this:
WebElement drawListFileUpload = webDriver.findElement(By.id("accordionPanel:listFileUpload"));
drawListFileUpload.clear();
drawListFileUpload.sendKeys(file);
Can anyone see what's going on? I've looked around for an answer relating to the HTMLUnit driver we use, but no cigar as yet... Similar code seems to work fine for a Primefaces calendar in the same form.