0

I have got selenium WebDriver testsuite done using TestNg framework. I have used selenium webDriver 2.44.0 & FF32.

Now my build team wants my test to run in their demo box which is linux machine. 10..*.248 box

What i have done till now. I am not using any other tools like jenkis, maven etc.

  1. Created java project 'myproject' testsuite in ecplise luna using TestNg frame in my windows machine
  2. Created a runnable Jar for myproject( myproject-version-1.0.1.jar)
  3. Placed the runnable jar in 248 box using winSCP in a folder /home/project/
  4. In 248 machine FF37 is available. So i upgraded my script with selenium 2.45.0 . It runs fine in my windows machine with FF32 version also.
  5. Now using putty i logged into 248 machine and reached the folder /home/project/ where my runnable jar is placed.
  6. I executed the shell command java -jar myproject-version-1.0.1.jar

Console shows the following exception:

[TestNG] Running:
  Command line suite
org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
Error: no display specified
Error: no display specified

I know i have not done correctly. I read few links posted here about about setting display in linux machine , using Xvfb – the X Virtual FrameBuffer. Webdriver Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms

I think the person who posted the question in above link had done the similar settings. !

Can somebody please help me with this as i am not able to understand :( Step by step process so that i can run my script in build team's machine.

I am very new to this field and doing all this for the first time. I read someting about headless GUI etc. I am not able to understand.

Would really appreciate if you could help me understand the steps involved.

Community
  • 1
  • 1
Pringa
  • 91
  • 2
  • 6
  • Build is using Red Hat based system. – Pringa May 19 '15 at 04:48
  • How your test Suite is designed? Can you post the method that is opening firefox browser? – 0o'-Varun-'o0 May 19 '15 at 05:52
  • Hi Aura , below is my code to set up the firefox. This works fine for my windows machine @BeforeTest public void setUp() { WebDriver driver=new FirefoxDriver(); driver.manage().window().maximize(); driver.manage().timeouts().implicitlyWait(30,TimeUnit.SECONDS); driver.get("http://docs.seleniumhq.org/"); } – Pringa May 19 '15 at 08:31

1 Answers1

0

You have done pretty much the right things as specified in the question

One thing that I came to observer that you have not specified complete URL in the get method. This might cause you some trouble. So first edit

driver.get("docs.seleniumhq.org/");

to

driver.get("http://docs.seleniumhq.org/");

If the code still doesn't works. Then try bundling latest selenium-java.jar and selenium-standalone.jar

But from the error it also seems that may be port 7055 is not free. (but I think you already checked that.)

So the problem gets a little bit confined to the selenium jars which are often incompatible if they are of different versions.

0o'-Varun-'o0
  • 735
  • 1
  • 5
  • 22
  • Hi aura. Thank u for your response. driver.get("URL ") i have given the complete llink only . till it doesnt work. I strongly feel its bcos of headless GUI. Maybe my script is not able to find the browser in that 248 linux machine. in 248 machine... command line .. i gave the command firefox -v so could see Morzilla Firefox 37.0.1. So firefox is there in the machine rt? i am using selenium 2.45.0. But as u mentioned what is the need of selenium.standalone ? as i m using webDriver – Pringa May 20 '15 at 05:10
  • I was successfully able to reproduce the situation. Try to login on your linux machine with the command "ssh -X user@ip". If possible try it with some other linux machine instead of using putty. In my case the browser opened. – 0o'-Varun-'o0 May 20 '15 at 09:36
  • HI Aura, i seriously need help. I am still facing the same issue. Running my jar file in linux machine 10.**.***.248 using a putty. this 248 machine has firefox installed. When i run the jar file in my command prompt in my windows machine the code runs fine. But in linux m/c still shows the same error [TestNG] Running: Command line suite org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output: Error: no display specified – Pringa Jun 01 '15 at 10:11
  • So i do feel its because its not getting a proper GUI ?? cos then how can it run fine in Command prompt in windows m/c and not in linux m/c – Pringa Jun 01 '15 at 10:12
  • older versions of putty might create this problem thats why i asked if you can try ssh with a linux machine. Did you tried what I mentioned above? – 0o'-Varun-'o0 Jun 02 '15 at 08:34