如何使在Windows机器中创建的webDriver测试套件在linux框中运行 [英] How to make webDriver testsuite created in windows machine to run in a linux box

查看:59
本文介绍了如何使在Windows机器中创建的webDriver测试套件在linux框中运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用TestNg框架完成了硒WebDriver测试套件.我已经使用了硒webDriver 2.44.0& FF32.

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

现在,我的构建团队希望我的测试在其Linux计算机的演示框中运行. 10. .* .248框

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

到目前为止我一直在做什么.我没有使用jenkis,maven等其他任何工具.

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

  1. 使用ecplise luna创建Java项目'myproject'测试套件 Windows计算机中的TestNg框架
  2. 为myproject(myproject-version-1.0.1.jar)创建了一个可运行的Jar
  3. 使用winSCP将可运行的jar放入248盒中的/home/project/
  4. 文件夹中
  5. 在248机中可以使用FF37.所以我用硒2.45.0升级了我的脚本.它在带有FF32版本的Windows机器上也可以正常运行.
  6. 现在使用腻子登录248机,并到达放置我的可运行jar的文件夹/home/project/.
  7. 我执行了shell命令 java -jar myproject-version-1.0.1.jar
  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

控制台显示以下异常:

[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

我知道我做得不正确.我读到了一些关于使用Xvfb – X Virtual FrameBuffer在linux机器上设置显示的链接. Webdriver 45000毫秒后无法连接到端口7055上的主机127.0.0.1

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.

我是这个领域的新手,而且是第一次.我读了一些关于无头GUI的内容.我听不懂.

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.

推荐答案

您已经按照问题中的说明做了正确的事情

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

我发现,您没有在get方法中指定完整的URL.这可能会给您带来麻烦.因此,首先编辑

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/");

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

如果代码仍然不起作用.然后尝试捆绑最新的selenium-java.jar和selenium-standalone.jar

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

但是从错误看来,端口7055可能不是空闲的. (但我想您已经检查过了.)

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.

这篇关于如何使在Windows机器中创建的webDriver测试套件在linux框中运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆