RC not working on Mac OS X 10.5.5 with Java

12 views
Skip to first unread message

Riccardo

unread,
Oct 1, 2008, 8:12:45 AM10/1/08
to selenium-users...@googlegroups.com
Hi,

most probably i'm just dumb, but i'm not able to get the RC working from a simple java code.

Configuration: selenium-remote-control-1.0-beta-1 on a MacOsX 10.5.5 with java version "1.6.0_07".

In interactive mode it seems that the server is working properly, I'm able to have it create new sessions, open pages, etc.

In non interactive mode, it also seems to work correctly while issuing commands from a browser. For instance, if I navigate to the following address in a browser (http://localhost:4444/selenium-server/driver/?cmd=getNewBrowserSession&1=*safari&2=http://www.google.com) i receive the following response:

OK,1f09bbb7e578428f847beed408176ea0

and safari starts up.

Notice also that the server logs this messages (running in debug mode):

13:47:56.605 DEBUG - new HttpConnection: Socket[addr=/0:0:0:0:0:0:0:1%0,port=51676,localport=4444]
13:47:56.648 DEBUG - REQUEST from SocketL...@0.0.0.0:4444:
GET /selenium-server/driver/?cmd=getNewBrowserSession&1=*safari&2=http://www.google.com HTTP/1.1

...


So, I'm assuming the server part is working correctly.

Now, if i try to execute the following class:

package es.tsbsoluciones.timeservice.test.utility;\\ \\ import com.thoughtworks.selenium.DefaultSelenium;\\ import com.thoughtworks.selenium.Selenium;\\ \\ public class TestSeleniumRC1 {
> public static void main(String[] args) throws Exception {\\ Selenium selenium = new DefaultSelenium("localhost",4444,"*safari","http://www.google.com");
> selenium.start();\\ \\ selenium.open("http://www.google.com/webhp");\\ \\ selenium.type("q", "selenium");\\ \\ selenium.submit("f");\\ \\ selenium.waitForPageToLoad("3000");\\ \\ selenium.stop();\\ }
}

I get the following error:
Exception in thread "main" com.thoughtworks.selenium.SeleniumException: \\ at com.thoughtworks.selenium.HttpCommandProcessor.doCommand(HttpCommandProcessor.java:73)\\ at com.thoughtworks.selenium.DefaultSelenium.open(DefaultSelenium.java:234)\\ at es.tsbsoluciones.timeservice.test.utility.TestSeleniumRC1.main(TestSeleniumRC1.java:13)

which doesn't say anything, 'cos it happears that the server is providing a 200 response but with no text in it (like, no OK... ). In reality, my guess is that the server is not contacted at all. Notice that the server does not log any connection attempt. This behaviour occurs equally when running the test class from eclipse or from the command line. Moreover, if a wrong address is provided, I get a connection error (as it would be expected).

I digged this down to the following test case, which seems to be the root of the problem:

public static void main(String[] args) throws Exception {\\ URL url=new URL("http://localhost:4444");\\ HttpURLConnection uc=(HttpURLConnection)url.openConnection();\\ System.out.println(uc.getResponseCode() + " " + uc.getResponseMessage());\\ }

Executing this code generates the following exception:

Exception in thread "main" java.net.SocketException: Unexpected end of file from server\\ at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:769)\\ at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:632)\\ at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:766)\\ at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:632)\\ at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1000)\\ at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:373)\\ at es.tsbsoluciones.timeservice.test.utility.TestSeleniumRC.main(TestSeleniumRC.java:33)

instead of returning the 403 http response code as it would be expected ('cos the url is not valid of course).

All these test work properly on a windows xp machine. The problem is not related to the specific browser as i've tested both safari, firefox (an ie on the windows machine).

So, what am I doing wrong?

Best,
Riccardo.

PS:
This is the output when starting the server (for reference):
15:46:57.255 INFO - Java: Apple Inc. 1.6.0_07-b06-57\\ 15:46:57.256 INFO - OS: Mac OS X 10.5.5 x86_64\\ 15:46:57.258 INFO - v1.0-beta-1 [2201], with Core v1.0-beta-1 [1994]\\ 15:46:57.351 INFO - Version Jetty/5.1.x\\ 15:46:57.352 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]\\ 15:46:57.353 INFO - Started HttpContext[/selenium-server,/selenium-server]\\ 15:46:57.353 INFO - Started HttpContext[/,/]\\ 15:46:57.365 INFO - Started SocketListener on 0.0.0.0:4444\\ 15:46:57.365 INFO - Started org.mortbay.jetty.Server@7a03411a

Message was edited by: Riccardo
 Added other details, and a basic test case

Xuan Ngo

unread,
Oct 1, 2008, 10:10:26 AM10/1/08
to selenium-users...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages