aspose file tools*
The moose likes Testing and the fly likes Selenium/Fitnesse and JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Testing
Bookmark "Selenium/Fitnesse and JSP" Watch "Selenium/Fitnesse and JSP" New topic
Author

Selenium/Fitnesse and JSP

Sachin Dere
Ranch Hand

Joined: Jan 14, 2003
Posts: 80
Hi guys,
I need to test an internal WebSite using Fitnesse/Selenium. Most of the pages in the Website are written in JSF and I am not able to test even the Login Page.When the Login Page is loaded by Selenium, i cannot login even when i do it manually. Is there any problem? Can Fitnesse/Selenium test JSF pages?
please help
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
It would help if you could describe why you cannot, for example, log in.

I have heard of JSF creating dynamic ID attribute values for the HTML elements it generates, which obviously screws up any test automation approach based on identifying elements by their IDs but, if this is the source of your problems, I've also heard that the Tomahawk extensions to MyFaces would allow you to use fixed IDs. I've never used that stuff myself, though, so it's just hear-say.


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Ben Blanchard
Greenhorn

Joined: Jun 09, 2008
Posts: 2
I'm having the same problem. When the login page (which is a JSP file) gets loaded, Selenium appears to open it, but just hangs. Trying to send further commands to that session on the command line results in:

INFO - Got result: ERROR: got a null result on session #####


In my python script, all commands after the "open" don't get executed, as the script hangs on the open command (even though it looks like the page gets fully loaded).

However, if I:
1) start selenium
2) open a new tab and point it the login page
3) login (a cookie gets saved so that new windows on the same session don't have to login)
4) tell selenium to go to the main page (which now bypasses the login page)
5) try to type stuff/test things

It works fine, as far as I can tell. But that isn't something I want to go through every time I try to run a test script. Anyone know of any Selenium/JSP errors that might be tripping the login page up? (Oddest thing is, other pages on the site use JSP, but selenium can load them just fine.)

Not sure if this is even the right place to be asking, so I thought I'd check. If you need more information, please ask.

Actually something else I noticed that seems odd is that when I normally open a page in Selenium, it opens the page in the bottom frame of the session. However, when it tries to open the login page, the selenium frames disappear, and it opens the login page in the entire window.
Ben Blanchard
Greenhorn

Joined: Jun 09, 2008
Posts: 2
Just thought I'd post the solution I came across (well, it doesn't really solve anything, but it lets my tests run).

When I start my selenium server, I use the -multiWindow option, and this seems to avoid the issue. i.e.

java -jar selenium-server.jar -multiWindow



Hopefully that helps you too, Sachin!
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Originally posted by Ben Blanchard:
Actually something else I noticed that seems odd is that when I normally open a page in Selenium, it opens the page in the bottom frame of the session. However, when it tries to open the login page, the selenium frames disappear, and it opens the login page in the entire window.

That sounds like the login page has JavaScript in it that enforces the login page to be displayed in the "_top" frame, effectively screwing up Selenium which works on the assumption that the application runs in the bottom frame.
 
wood burning stoves
 
subject: Selenium/Fitnesse and JSP