开发者

Selenium: Invalid "already running" error when starting server

I am trying to get the Selenium server up and running. However, when I type:

java -jar selenium-server-standalone-2.0b3.jar

I get an Exception:

开发者_JS百科

Selenium is already running on port 4444. Or some other service is.

I have tried to stop it, just in case it really is running:

http://localhost:4444/selenium-server/driver/?cmd=shutDown

That gets me the message:

ERROR Server Exception: sessionId should not be null; has this session been started yet?

If I just write:

http://localhost:4444/

I get:

HTTP ERROR: 403

Forbidden for Proxy

Ideas?


This worked for me:

http://localhost:4444/selenium-server/driver/?cmd=shutDownSeleniumServer

If selenium server is already running on port 4444 then it will shut down the server and says OKOK if selenium is not running on this port 4444 then by hitting above url will give you "Unable to connect"


try this:

lsof -i -n -P | grep 4444

and kill the process it says is on :4444


One-liner:

kill -9 $(lsof -ti tcp:4444)


The error message Selenium offers up is a little confusing. It really should be telling you you're making a syntax error. I had this problem as well. Make sure the cmd string is PRECISELY like this:

http://localhost:4444/selenium-server/driver/?cmd=shutDownSeleniumServer

That means using the full command shutDownSeleniumServer, and make sure the s in shut is lower-case (That was my mistake).

Hope this helps.


To shut down the server you can use: http://localhost:4444/selenium-server/driver/?cmd=shutDownSeleniumServer

It will give message OKOK , means it got shutdown. If the server is not running then it will show "This web page not available"

To check the selenium server status , use this http://localhost:4444/selenium-server/driver/?cmd=getLogMessages

It will give OK if server is running , if not running then it will show webpage not available


If you are using Windows, you can open the task manager and locate the java.exe or javaw.exe process and kill it. This will release port 4444 and you should be able to restart the Selenium server.


I had the same error but no server was running. Tuned out the java version was in cause. Make sure you are running java 7 or higher:

java -version


lsof returned no results in my case.

On a Ubuntu machine I had to do the following:

sudo netstat -tapen | grep ":4444 "

Reply was like:

tcp6       0      0 XXXXXXXXX:4444       :::*                    LISTEN      107        31526       **10479**/java

And to kill the Selenium server process identified (in my case) with 10479

sudo kill 10479


In OSX if you follow the command from @HaloWebMaster (lsof -i -n -P | grep 4444) the next step is to take the PID (usually a 4 - 5 digit number indicating the process ID) and run the following command:

kill -9 <PID>

You shouldn't need sudo unless the process was started by another user or root.


If you started Selenium using Java (instead of via whatever testing framework you may or may not be using), you can kill all leftover Selenium instances with:

pkill java

That's guaranteed to kill any java relics (including selenium if started this way) - but be careful here - caveat is that you might be killing other procs too (due to the way pkill works). In my case, I want to kill anything running in the JVM, so this solved it for me.

As per the comment from Goldberg below, note that this will not kill any driver services or browsers running on your system!


I had the same problem , I started my Jboss AP where i have my application deployed and after that tried to run the selenium server and couldn t start. The problem was that Jboss uses the same port that Selenium server uses, so what I did is to start selenium server on a different port

Solution:

java -jar selenium-server-standalone-2.0b3.jar -port 1234 -htmlSuite "*firefox" "http://localhost:8080/" "path to the suite" "path to the results"


For Windows, try this:

taskkill /PID <ProcessID> /F


If you get a 403 error on 127.0.01:4444 and not a 404 one, something is running there. (You're positive it cannot be a previous instance Selenium ? It'd be the most logical.)

Sometimes Selenium continue running in the background after an unexpected exit. I'd suggest checking the running processes, or rebooting the machine if everything else fails.

It happens to me frequently when Hudson asks Selenium-Server to run some tests and it fails in the middle for some reasons. Killing the process solves the problem.


That ERROR Server Exception: sessionId should not be null; has this session been started yet? message comes from Selenium. If you're seeing it, there's a Selenium server running on that port number.


If all the above is not working, please save your work and reboot your system. It will solve the problem


Thanks,

The link of Andre works fine for me.

As 4444 is the default port of Selenium check this as well.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜