user3085217
user3085217

Reputation: 31

Port 4444 is busy, please choose a free port and specify it using -port option

i install protractor using this command:

npm install -g protractor,

webdriver-manager update,

webdriver-manager start,

after installing this webdriver manager was running fine. then for some reason i thought i need selenium server standalone. so i install it using this command:

npm install selenium-standalone@latest -g selenium-standalone install selenium-standalone start

Now if I run any one of either webdriver-manager start or selenium -standalone start I get these error. I am not running both at the same time.

I/start - java -Dwebdriver.chrome.driver=/usr/local/lib/node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_2.41 -Dwebdriver.gecko.driver=/usr/local/lib/node_modules/protractor/node_modules/webdriver-manager/selenium/geckodriver-v0.21.0 -jar /usr/local/lib/node_modules/protractor/node_modules/webdriver-manager/selenium/selenium-server-standalone-3.13.0.jar -port 4444
[10:17:56] I/start - seleniumProcess.pid: 39645
10:17:57.250 INFO [GridLauncherV3.launch] - Selenium build info: version: '3.13.0', revision: '2f0d292'
10:17:57.251 INFO [GridLauncherV3$1.launch] - Launching a standalone Selenium Server on port 4444
2018-08-02 10:17:57.408:INFO::main: Logging initialized @612ms to org.seleniumhq.jetty9.util.log.StdErrLog
10:17:57.589 ERROR [SeleniumServer.boot] - Port 4444 is busy, please choose a free port and specify it using -port option
[10:17:57] I/start - Selenium Standalone has exited with code 0.

if anyone knows the reason please let me know.

Upvotes: 0

Views: 27618

Answers (8)

yong
yong

Reputation: 13722

Because a selenium server started by webdriver-manager start on the default port 4444, and it's still running, not terminal.

So when you execute webdriver-manager start or selenium -standalone start without specifying port, it will try to start another selenium server on 4444 again which is used by previous selenium server. That's why you get Port 4444 is busy

You can find the process of selenium server and kill it to release the port 4444, or specify the port to different number for webdriver-manager start or selenium -standalone start

Try webdriver-manager shutdown to stop selenium server.

And webdriver-manager update will install selenium-server-standalone.jar, so you no need to install selenium-standalone to help to install selenium-server-standalone.jar.

Upvotes: 3

Sofiia Kotyk
Sofiia Kotyk

Reputation: 11

if you are following Megan Lewis course on LinkedIn you should specify your own port

java -jar .\selenium-server-standalone-3.141.59.jar -role hub -port 5555 (choose your number)

Upvotes: 1

Seema Nair
Seema Nair

Reputation: 165

If you are on Windows:

As you are using npm, an easy solution is to install

$ npm install --global kill-port and then you can call

$ kill-port --port 4444

before running your tests.

If you are on Mac or Linux: you can use pkill -f selenium-standalone

Upvotes: 1

Kedel Mihail
Kedel Mihail

Reputation: 151

You can type in your console(cmd for Windows)

webdriver-manager

and it will give you a list of options for your Selenium Standalone server. If you want to change the port use --seleniumPort option,

webdriver-manager start --seleniumPort 12345

this will change your port to 12345, so Selenium Server would start on port 12345, instead of 4444.

Hope it'll help you.

Upvotes: 2

Karthik
Karthik

Reputation: 11

Use below command to start the server by changing the Port Number

java - Dwebdriver.chrome.driver=C:\Users\chromedriver_path\chromedriver_2.45.exe -Dwebdriver.gecko.driver=C:\Users\geckodriver_path\geckodriver-v0.23.0.exe -jar C:\Users\selenium_server_jar_path\selenium-server-standalone-3.141.59.jar -port 4446

Please change the paths as per your system configurations [This Solution is for Windows machine]

Upvotes: 1

santhosh v
santhosh v

Reputation: 31

I came across this issue when running protractor tests. The below two solutions works for me

1) Stop server by below command. http://localhost:4444/selenium-server/driver/?cmd=shutDownSeleniumServer

2) Uncomment seleniumAddress: 'http://localhost:4444/wd/hub save and run the tests.

In case-2: Selenium web driver starts running by default on start running the protractor tests.

Upvotes: 1

Achooo
Achooo

Reputation: 107

try the following to kill anything on that port:

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

If the command webriver-manager shutdown does not work.

Upvotes: 5

dangi13
dangi13

Reputation: 1275

just start selenium standalone server at another port : e.g :

C:\Users\username\Desktop\Essentials\SeleniumStandaloneJars>java -jar selenium-server-standalone-3.11.0.jar -port 8090

Hope that helps you.

Upvotes: 1

Related Questions