How to make webDriver testsuite created in windows machine to run in a linux box

血红的双手。 提交于 2019-12-23 05:13:07

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/30316921/how-to-make-webdriver-testsuite-created-in-windows-machine-to-run-in-a-linux-box

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!