You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "Thiago H. de Paula Figueiredo" <th...@gmail.com> on 2010/08/19 03:12:40 UTC

TextOutputStream and Selenium

Hi!

I have a page that returns a TextStreamResponse("text/html", content),  
where content is a string containing HTML fetched from the file system. It  
hasn't any JavaScript code. The HTML is rendered correctly.

When I run a Selenium test, s.waitForPageToLoad() hangs until it timeouts.  
I can see the page opened in the Firefox instance Selenium opens.

Any hints?

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: TextOutputStream and Selenium

Posted by Josh Canfield <jo...@gmail.com>.
Hmm... Let me know if you figure out the culprit. Does the page have JavaScript that might have errors? 

-- Josh

On Aug 19, 2010, at 4:32 PM, "Thiago H. de Paula Figueiredo" <th...@gmail.com> wrote:

> On Thu, 19 Aug 2010 17:12:26 -0300, Josh Canfield <jo...@gmail.com> wrote:
> 
>> Ok, I can't reproduce. Here is what I've tried.
>> Have you tried cutting the content of your response down to a minimum?
> 
> I haven't tried this yet.
> 
>> Maybe there is something in the page?
> 
> With your input, I think the problem is in the my pages' HTML. My page class looks like yours. Thanks for the help!
> 
> -- 
> Thiago H. de Paula Figueiredo
> Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor
> Owner, Ars Machina Tecnologia da Informação Ltda.
> http://www.arsmachina.com.br
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: TextOutputStream and Selenium

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Thu, 19 Aug 2010 17:12:26 -0300, Josh Canfield <jo...@gmail.com>  
wrote:

> Ok, I can't reproduce. Here is what I've tried.
> Have you tried cutting the content of your response down to a minimum?

I haven't tried this yet.

> Maybe there is something in the page?

With your input, I think the problem is in the my pages' HTML. My page  
class looks like yours. Thanks for the help!

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: TextOutputStream and Selenium

Posted by Josh Canfield <jo...@gmail.com>.
Ok, I can't reproduce. Here is what I've tried.

public class TextStreamPage {

    private String _content = "nothing";

    @Inject
    private LinkSource _linkSource;

    void onActivate(String content) {
        _content = content;
    }

    TextStreamResponse onActivate() {
        final String link =
                _linkSource.createPageRenderLink("TextStreamPage",
true, "clicked").toAbsoluteURI();
        return new TextStreamResponse("text/html",
                "<html><body>Content:" +
                        "<div id='content'>" + _content + "</div>" +
                        "<a id='link' href='" + link + "'>click</a>" +
                        "</body></html>");
    }
}
and this test:

   @Test
public class TextStreamTest extends AbstractIntegrationTestSuite {

    @Test
    public void testPageLoad() {
        open("/");
        open("/textstreampage/test");
        assertText("content", "test");
        click("link");
        waitForPageToLoad("2000");
        assertText("content", "clicked");
    }
}

Have you tried cutting the content of your response down to a minimum?
Maybe there is something in the page?

-- Josh

On Aug 19, 2010, at 8:42 AM, "Thiago H. de Paula Figueiredo"
<th...@gmail.com> wrote:

> On Thu, 19 Aug 2010 12:07:29 -0300, Josh Canfield <jo...@gmail.com> wrote:
>
>> This is the code I wanted to see. Do you get the same result with clickandwait (dropping the waitforpage of course)
>
> I forgot to mention that even selenium.open() in that page timesout after the launched Firefox instance shows the page. I guess somehow JavaScript isn't running in that page. Thanks for the tips, Josh!
>
> --
> Thiago H. de Paula Figueiredo
> Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor
> Owner, Ars Machina Tecnologia da Informação Ltda.
> http://www.arsmachina.com.br
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: TextOutputStream and Selenium

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Thu, 19 Aug 2010 12:07:29 -0300, Josh Canfield <jo...@gmail.com>  
wrote:

> This is the code I wanted to see. Do you get the same result with  
> clickandwait (dropping the waitforpage of course)

I forgot to mention that even selenium.open() in that page timesout after  
the launched Firefox instance shows the page. I guess somehow JavaScript  
isn't running in that page. Thanks for the tips, Josh!

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: TextOutputStream and Selenium

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Thu, 19 Aug 2010 12:07:29 -0300, Josh Canfield <jo...@gmail.com>  
wrote:

>> selenium.click(locator);
>> s.waitForPageToLoad("300000");
>
> This is the code I wanted to see. Do you get the same result with  
> clickandwait (dropping the waitforpage of course)

Yes.

> Is the locator pointing at a plain link?

Yes. The mind boggles . . .

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: TextOutputStream and Selenium

Posted by Josh Canfield <jo...@gmail.com>.
> selenium.click(locator);
> s.waitForPageToLoad("300000");

This is the code I wanted to see. Do you get the same result with clickandwait (dropping the waitforpage of course)

Is the locator pointing at a plain link?

-- Josh

On Aug 19, 2010, at 6:53 AM, "Thiago H. de Paula Figueiredo" <th...@gmail.com> wrote:

> On Wed, 18 Aug 2010 22:48:18 -0300, Josh Canfield <jo...@gmail.com> wrote:
> 
>> Can you show the code you're using to open the page?
> 
> Not really, but it's pretty common:
> 
> selenium.click(locator);
> s.waitForPageToLoad("300000");
> 
>> Are you calling waitForPageToLoad directly? Do you need to?
> 
> Yes, as otherwise the following test would run in the previous page.
> 
> -- 
> Thiago H. de Paula Figueiredo
> Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor
> Owner, Ars Machina Tecnologia da Informação Ltda.
> http://www.arsmachina.com.br
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: TextOutputStream and Selenium

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Wed, 18 Aug 2010 22:48:18 -0300, Josh Canfield <jo...@gmail.com>  
wrote:

> Can you show the code you're using to open the page?

Not really, but it's pretty common:

selenium.click(locator);
s.waitForPageToLoad("300000");

> Are you calling waitForPageToLoad directly? Do you need to?

Yes, as otherwise the following test would run in the previous page.

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: TextOutputStream and Selenium

Posted by Josh Canfield <jo...@gmail.com>.
Can you show the code you're using to open the page?

Are you calling waitForPageToLoad directly? Do you need to?

Usually when vie seen this it's because wait was called twice inadvertently.

-- Josh

On Aug 18, 2010, at 6:12 PM, "Thiago H. de Paula Figueiredo" <th...@gmail.com> wrote:

> Hi!
> 
> I have a page that returns a TextStreamResponse("text/html", content), where content is a string containing HTML fetched from the file system. It hasn't any JavaScript code. The HTML is rendered correctly.
> 
> When I run a Selenium test, s.waitForPageToLoad() hangs until it timeouts. I can see the page opened in the Firefox instance Selenium opens.
> 
> Any hints?
> 
> -- 
> Thiago H. de Paula Figueiredo
> Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor
> Owner, Ars Machina Tecnologia da Informação Ltda.
> http://www.arsmachina.com.br
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org