Hi,

It looks like this could be a bug with HtmlUnit. All clickButtonWithText()
does is send a click event through to HtmlUnit. Could you follow it up with
them? Is the URL of the page you are testing publicly available?

Alternatively maybe you can disable your CSS styles and see if there is a
style that is causing the bug. Maybe the IFrame has some invalid styles or
content.

Cheers
Jevon



On Thu, May 15, 2014 at 2:19 AM, Marco Ferretti <marco.ferre...@gmail.com>wrote:

> Hi all,
> I am new to JWebUnit: I have just created a test project where I am trying
> to achieve some experience by creating unit tests for a portlet application
> that is already in production. With this in mind I have successfully
> managed to test login,  change views and submit files through a form.
> Now, I am trying to perform a download of a text file and parse it. The
> application provides, after the upload, a button named "Download Results"
> that fires a javascript that, on the fly, creates an iframe with the path
> to the document to download. The browser then automagically downloads the
> text file.
>
> I have tried to code the action as follows:
>
>         try {
>             File file = File.createTempFile("test" +
> System.currentTimeMillis(), ".txt");
> //            assertTextPresent("Data received!");
>             clickButtonWithText("Download Results");
>             saveAs(file);
>             Scanner scanner = new Scanner(file);
>             String line;
>             int lineN = 0;
>             int maxLine = 20;
>             while ( scanner.hasNextLine() && lineN < maxLine ) {
>                 line = scanner.nextLine();
>                 if ( line.toUpperCase().contains("SUCCESS")) {
>                     org.junit.Assert.assertTrue(true);
>                     lineN = maxLine;
>                 }
>                 ++lineN;
>             }
>         }
>         catch (IOException e) {
>             // TODO Auto-generated catch block
>             e.printStackTrace();
>         }
>
> 
>
> but I am getting a stack overflow (full result of the test attached);
> What am I missing ?? Is there any source of documentation/examples on how
> I can try to download that file ?
>
> TIA
>
>
>
> --
> --
> Marco Ferretti
> [image: facebook] <http://facebook.com/marco.ferretti>[image: 
> twitter]<http://twitter.com/marcoferretti>[image:
> Linkedin] <http://it.linkedin.com/in/marcoferretti>[image: 
> Website]<http://www.fermasoft.com>
>  [image: public 
> key]<http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x3863B939F579CD16>
>
>
>
>
>
>
> ------------------------------------------------------------------------------
> "Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
> Instantly run your Selenium tests across 300+ browser/OS combos.
> Get unparalleled scalability from the best Selenium testing platform
> available
> Simple to use. Nothing to install. Get started now for free."
> http://p.sf.net/sfu/SauceLabs
> _______________________________________________
> JWebUnit-users mailing list
> JWebUnit-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jwebunit-users
>
>
------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
JWebUnit-users mailing list
JWebUnit-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jwebunit-users

Reply via email to