简体   繁体   English

在LInux上使用Firefox运行硒测试

[英]Run selenium test using firefox on LInux

Linux Ubuntu Firefox 43 Selenium 2.53.1 Linux Ubuntu Firefox 43硒2.53.1

I installed Xvfb then I did something like this 我安装了Xvfb,然后做了这样的事情

Xvfb :77 -ac Xvfb:77 -ac

and

export DISPLAY=:77 出口DISPLAY =:77

then I checked if firefox works on linux ($firefox) -> launched without error, and stay running until I kill it with Control-C 然后我检查了firefox是否可以在linux($ firefox)上运行->启动没有错误,并一直运行直到我用Control-C杀死它为止

Now I try to start my selenium tests using Jenkins. 现在,我尝试使用Jenkins开始进行硒测试。 I indicated my DISPLAY but when I run tests I get: 我指出了DISPLAY,但是当我运行测试时,我得到:

org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. org.openqa.selenium.firefox.NotConnectedException:在45000毫秒后无法连接到端口7055上的主机127.0.0.1。 Firefox console output: Firefox控制台输出:

at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:113)
at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:271)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:119)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:216)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:211)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:207)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:120)
at com.rulefinancial.testing.webdriver.LocalFirefoxDriverProvider.getNewWebDriver(LocalFirefoxDriverProvider.java:16)
at com.rulefinancial.testing.MainTest.beforeClass(MainTest.java:54)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:86)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:514)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:215)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:142)
at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:178)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108)
at org.testng.TestRunner.privateRun(TestRunner.java:782)
at org.testng.TestRunner.run(TestRunner.java:632)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:366)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:361)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:319)
at org.testng.SuiteRunner.run(SuiteRunner.java:268)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1244)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1169)
at org.testng.TestNG.run(TestNG.java:1064)
at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:281)
at org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:75)
at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:121)
at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:290)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:242)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:121)

Can anyone tell me what happens here? 谁能告诉我这里发生了什么? How to solve this problem? 如何解决这个问题呢? It works fine on windows - I mean ff 43 and selenium 2.53.1 在Windows上工作正常-我的意思是ff 43和硒2.53.1

Check the parameters of the X virtual frame buffer, when you start it. 启动时检查X虚拟帧缓冲区的参数。 I think the issue is here. 我认为问题就在这里。 For me it worked, I did it step by step following headless execution of selenium tests in Jenkins blog post. 对我来说,它确实有效,我在詹金斯(Jenkins)博客文章中无休止地执行了硒测试之后,一步一步地做到了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在 Linux 服务器上运行 Selenium WebDriver 测试 - Run Selenium WebDriver test on a linux server Python Selenium 当使用 Firefox geckodriver 的绝对路径时,测试不运行 - Python Selenium test does not run when using absolute path to Firefox geckodriver Linux Mint中的Selenium PHPUnit测试中的空白Firefox窗口问题 - Blank Firefox Window Issue in Selenium PHPUnit Test in Linux Mint 使用Jenkins部署到Linux服务器,然后从Windows服务器运行硒测试 - Using Jenkins to deploy to a Linux server and then run selenium test from a windows server 我们可以在 linux 的非无头模式下运行 selenium 测试吗? - Can we run selenium test in non-headless mode in linux? 在Linux中使用Selenium运行无头Firefox - Running headless firefox with selenium in Linux 使用Selenium Grid从Linux集线器运行IE测试 - Using Selenium Grid to run IE tests from a linux hub 硒-WebDriver-Firefox 64位Linux - selenium - webdriver - firefox 64 bit linux selenium webdriver在带firefox浏览器的无头Linux上使用python在下拉菜单中选择一个选项 - selenium webdriver select an option in dropdown menu using python on headless Linux with firefox browser 如何在不使用Intellij的情况下在Linux centos中运行黄瓜测试用例 - How to run cucumber test cases in Linux centos without using Intellij
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM