我正在使用maven项目运行selenium测试,但是当我运行测试文件时,我收到了错误:无法连接到二进制FirefoxBinary(C:\Program Files(x86)\Mozilla Firefox\Firefox)。在端口7055上。它打开FF an的空白页,然后测试结果抛出错误:
Failed to connect to binary FirefoxBinary(C:\Program Files (x86)\Mozilla Firefox\firefox.exe) on port 7055; process output follows: e":true,"v":"1.0.5","st":1484790105743},"webcompat@mozilla.org":{"d":"C:\\Program Files (x86)\\Mozilla Firefox\\browser\\features\\webcompat@mozilla.org.xpi","e":true,"v":"1.0","st":1484790105745}},"app-global":{"{972ce4c6-7e08-4474-a285-3208198ce6fd}":{"d":"C:\\Program Files (x86)\\Mozilla Firefox\\browser\\extensions\\{972ce4c6-7e08-4474-a285-3208198ce6fd}.xpi","e":true,"v":"51.0","st":1484790105687}},"winreg-app-global":{"{D19CA586-DD6C-4a0a-96F8-14644F340D60}":{"d":"C:\\Program Files (x86)\\Common Files\\McAfee\\SystemCore","e":false,"v":"15.4.0","st":1484874384474,"mt":1481296942197}}} 1487083932603 addons.xpi DEBUG No changes found 1487083932618 addons.xpi DEBUG Registering manifest for C:\Program Files (x86)\Mozilla Firefox\browser\features\aushelper@mozilla.org.xpi 1487083932620 addons.xpi DEBUG Loading bootstrap scope from C:\Program Files (x86)\Mozilla Firefox\browser\features\aushelper@mozilla.org.xpi 1487083932629 addons.xpi DEBUG Calling bootstrap method startup on aushelper@mozilla.org version 1.0 1487083932631 addons.xpi DEBUG Registering manifest for C:\Program Files (x86)\Mozilla Firefox\browser\features\e10srollout@mozilla.org.xpi 1487083932633 addons.xpi DEBUG Loading bootstrap scope from C:\Program Files (x86)\Mozilla Firefox\browser\features\e10srollout@mozilla.org.xpi 1487083932638 addons.xpi DEBUG Calling bootstrap method startup on e10srollout@mozilla.org version 1.7 1487083932639 addons.xpi DEBUG Registering manifest for C:\Program Files (x86)\Mozilla Firefox\browser\features\firefox@getpocket.com.xpi 1487083932650 addons.xpi DEBUG Loading bootstrap scope from C:\Program Files (x86)\Mozilla Firefox\browser\features\firefox@getpocket.com.xpi 1487083932657 addons.xpi DEBUG Calling bootstrap method startup on firefox@getpocket.com version 1.0.5 1487083932669 addons.xpi-utils DEBUG Starting async load of XPI database C:\Users\EGLDT1~1\AppData\Local\Temp\anonymous5933286477074635697webdriver-profile\extensions.json 1487083932671 addons.xpi DEBUG Registering manifest for C:\Program Files (x86)\Mozilla Firefox\browser\features\webcompat@mozilla.org.xpi 1487083932673 addons.xpi DEBUG Loading bootstrap scope from C:\Program Files (x86)\Mozilla Firefox\browser\features\webcompat@mozilla.org.xpi 1487083932678 addons.xpi DEBUG Calling bootstrap method startup on webcompat@mozilla.org version 1.0 1487083932681 addons.manager DEBUG Registering shutdown blocker for XPIProvider 1487083932681 addons.manager DEBUG Provider finished startup: XPIProvider 1487083932681 addons.manager DEBUG Starting provider: LightweightThemeManager 1487083932681 addons.manager DEBUG Registering shutdown blocker for LightweightThemeManager 1487083932682 addons.manager DEBUG Provider finished startup: LightweightThemeManager 1487083932683 addons.manager DEBUG Starting provider: GMPProvider 1487083932701 addons.manager DEBUG Registering shutdown blocker for GMPProvider 1487083932701 addons.manager DEBUG Provider finished startup: GMPProvider 1487083932701 addons.manager DEBUG Starting provider: PluginProvider 1487083932702 addons.manager DEBUG Registering shutdown blocker for PluginProvider 1487083932702 addons.manager DEBUG Provider finished startup: PluginProvider 1487083932703 addons.manager DEBUG Completed startup sequence 1487083933230 addons.xpi-utils DEBUG Async JSON file read took 0 MS 1487083933230 addons.xpi-utils DEBUG Finished async read of XPI database, parsing... 1487083933236 addons.xpi-utils DEBUG Successfully read XPI database 1487083933253 addons.manager DEBUG Starting provider: 1487083933253 addons.manager DEBUG Registering shutdown blocker for 1487083933253 addons.manager DEBUG Provider finished startup: *** Blocklist::_loadBlocklistFromFile: blocklist is disabled 1487083933441 addons.manager DEBUG Starting provider: PreviousExperimentProvider 1487083933442 addons.manager DEBUG Registering shutdown blocker for PreviousExperimentProvider 1487083933442 addons.manager DEBUG Provider finished startup: PreviousExperimentProvider Build info: version: '2.45.0', revision: '5017cb8e7ca8e37638dc3091b2440b90a1d8686f', time: '2015-02-27 09:10:26' System info: host: 'Moises_Zarate', ip: '172.29.6.108', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_60' Driver info: driver.version: FirefoxDriver org.openqa.selenium.WebDriverException e":true,"v":"1.0.5","st":1484790105743},"webcompat@mozilla.org":{"d":"C:\\Program Files (x86)\\Mozilla Firefox\\browser\\features\\webcompat@mozilla.org.xpi","e":true,"v":"1.0","st":1484790105745}},"app-global":{"{972ce4c6-7e08-4474-a285-3208198ce6fd}":{"d":"C:\\Program Files (x86)\\Mozilla Firefox\\browser\\extensions\\{972ce4c6-7e08-4474-a285-3208198ce6fd}.xpi","e":true,"v":"51.0","st":1484790105687}},"winreg-app-global":{"{D19CA586-DD6C-4a0a-96F8-14644F340D60}":{"d":"C:\\Program Files (x86)\\Common Files\\McAfee\\SystemCore","e":false,"v":"15.4.0","st":1484874384474,"mt":1481296942197}}} 1487083932603 addons.xpi DEBUG No changes found 1487083932618 addons.xpi DEBUG Registering manifest for C:\Program Files (x86)\Mozilla Firefox\browser\features\aushelper@mozilla.org.xpi 1487083932620 addons.xpi DEBUG Loading bootstrap scope from C:\Program Files (x86)\Mozilla Firefox\browser\features\aushelper@mozilla.org.xpi 1487083932629 addons.xpi DEBUG Calling bootstrap method startup on aushelper@mozilla.org version 1.0 1487083932631 addons.xpi DEBUG Registering manifest for C:\Program Files (x86)\Mozilla Firefox\browser\features\e10srollout@mozilla.org.xpi 1487083932633 addons.xpi DEBUG Loading bootstrap scope from C:\Program Files (x86)\Mozilla Firefox\browser\features\e10srollout@mozilla.org.xpi 1487083932638 addons.xpi DEBUG Calling bootstrap method startup on e10srollout@mozilla.org version 1.7 1487083932639 addons.xpi DEBUG Registering manifest for C:\Program Files (x86)\Mozilla Firefox\browser\features\firefox@getpocket.com.xpi 1487083932650 addons.xpi DEBUG Loading bootstrap scope from C:\Program Files (x86)\Mozilla Firefox\browser\features\firefox@getpocket.com.xpi 1487083932657 addons.xpi DEBUG Calling bootstrap method startup on firefox@getpocket.com version 1.0.5 1487083932669 addons.xpi-utils DEBUG Starting async load of XPI database C:\Users\EGLDT1~1\AppData\Local\Temp\anonymous5933286477074635697webdriver-profile\extensions.json 1487083932671 addons.xpi DEBUG Registering manifest for C:\Program Files (x86)\Mozilla Firefox\browser\features\webcompat@mozilla.org.xpi 1487083932673 addons.xpi DEBUG Loading bootstrap scope from C:\Program Files (x86)\Mozilla Firefox\browser\features\webcompat@mozilla.org.xpi 1487083932678 addons.xpi DEBUG Calling bootstrap method startup on webcompat@mozilla.org version 1.0 1487083932681 addons.manager DEBUG Registering shutdown blocker for XPIProvider 1487083932681 addons.manager DEBUG Provider finished startup: XPIProvider 1487083932681 addons.manager DEBUG Starting provider: LightweightThemeManager 1487083932681 addons.manager DEBUG Registering shutdown blocker for LightweightThemeManager 1487083932682 addons.manager DEBUG Provider finished startup: LightweightThemeManager 1487083932683 addons.manager DEBUG Starting provider: GMPProvider 1487083932701 addons.manager DEBUG Registering shutdown blocker for GMPProvider 1487083932701 addons.manager DEBUG Provider finished startup: GMPProvider 1487083932701 addons.manager DEBUG Starting provider: PluginProvider 1487083932702 addons.manager DEBUG Registering shutdown blocker for PluginProvider 1487083932702 addons.manager DEBUG Provider finished startup: PluginProvider 1487083932703 addons.manager DEBUG Completed startup sequence 1487083933230 addons.xpi-utils DEBUG Async JSON file read took 0 MS 1487083933230 addons.xpi-utils DEBUG Finished async read of XPI database, parsing... 1487083933236 addons.xpi-utils DEBUG Successfully read XPI database 1487083933253 addons.manager DEBUG Starting provider: 1487083933253 addons.manager DEBUG Registering shutdown blocker for 1487083933253 addons.manager DEBUG Provider finished startup: *** Blocklist::_loadBlocklistFromFile: blocklist is disabled 1487083933441 addons.manager DEBUG Starting provider: PreviousExperimentProvider 1487083933442 addons.manager DEBUG Registering shutdown blocker for PreviousExperimentProvider 1487083933442 addons.manager DEBUG Provider finished startup: PreviousExperimentProvider Build info: version: '2.45.0', revision: '5017cb8e7ca8e37638dc3091b2440b90a1d8686f', time: '2015-02-27 09:10:26' System info: host: 'Moises_Zarate', ip: '172.29.6.108', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_60' Driver info: driver.version: FirefoxDriver at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:130) at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:246) at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:114) at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:191) at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:186) at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:182) at ConsultaLogAuth.setUp(ConsultaLogAuth.java:26) 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.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:53) at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:123) at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:104) 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.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:164) at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:110) at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:175) at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcessWhenForked(SurefireStarter.java:107) at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:68) Caused by: org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output: e":true,"v":"1.0.5","st":1484790105743},"webcompat@mozilla.org":{"d":"C:\\Program Files (x86)\\Mozilla Firefox\\browser\\features\\webcompat@mozilla.org.xpi","e":true,"v":"1.0","st":1484790105745}},"app-global":{"{972ce4c6-7e08-4474-a285-3208198ce6fd}":{"d":"C:\\Program Files (x86)\\Mozilla Firefox\\browser\\extensions\\{972ce4c6-7e08-4474-a285-3208198ce6fd}.xpi","e":true,"v":"51.0","st":1484790105687}},"winreg-app-global":{"{D19CA586-DD6C-4a0a-96F8-14644F340D60}":{"d":"C:\\Program Files (x86)\\Common Files\\McAfee\\SystemCore","e":false,"v":"15.4.0","st":1484874384474,"mt":1481296942197}}}
这些是我的文件:
<dependencies>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.45.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium.server</groupId>
<artifactId>selenium-server</artifactId>
<version>2.48.2</version>
<scope>test</scope>
<type>jar</type>
</dependency>
</dependencies>
import java.io.File;
import java.util.regex.Pattern;
import java.util.concurrent.TimeUnit;
import org.junit.*;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;
import org.openqa.selenium.*;
import org.openqa.selenium.firefox.FirefoxBinary;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxProfile;
import org.openqa.selenium.support.ui.Select;
public class ConsultaLogAuth {
private WebDriver driver;
private String baseUrl;
private boolean acceptNextAlert = true;
private StringBuffer verificationErrors = new StringBuffer();
@Before
public void setUp() throws Exception {
File pathToBinary = new File("C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe");
FirefoxBinary ffBinary = new FirefoxBinary(pathToBinary);
FirefoxProfile firefoxProfile = new FirefoxProfile();
driver = new FirefoxDriver(ffBinary,firefoxProfile);
// driver = new FirefoxDriver();
baseUrl = "http://172.29.6.228:8025/";
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}
我有FireFox 51.0和selenium-java 2.45.0(jar)。
您需要升级Selenium服务器(例如升级到3.5.x),以便它能够支持您的新版本Firefox。
pom中的配置示例。xml
文件:
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.5.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium.server</groupId>
<artifactId>selenium-server</artifactId>
<version>3.5.2</version>
<scope>test</scope>
<type>jar</type>
</dependency>
见:
selenium java
和selenium服务器
我使用的是firefox版本23.0.1和selenium 2.35.0 jar。当我尝试运行脚本时,所有脚本都失败,错误消息是“未能连接到端口7055上的二进制FirefoxBinary(E:\Mozilla\firefox.exe)”。请帮我解决这个问题。 提前谢谢你,马纳萨。
我收到一个错误:无法连接到端口7055上的主机127.0.0.1 当我尝试在ubuntu服务器上用firefox运行selenium时。 谁能帮忙吗? 我有硒版2.53
我是一个新手,需要一些帮助。. 我正在使用Selenium 2.2.0和FF v7。Windows XP上的0.1 我已经成功地在IE中录制并回放了一个java脚本,但是每当我尝试在FF中执行相同的脚本时,我都会收到以下错误消息: 45000 ms后无法连接到端口7055上的主机127.0.0.1 我在很多地方读到,如果我将firefox版本降级到3.6,脚本将运行良好,但我并不热衷于降级。有人能
当我运行一个selenium网络驱动程序时,我得到了一个名为"org.openqa.selenium.firefox.NotConnectedExc0019的错误:无法连接到端口7055上的主机127.0.0.1后45000毫秒。火狐控制台输出”。 这个错误是什么。。?
在我的eclipse中运行代码(Selenium webDrive/java);但它显示错误45000毫秒后无法连接到端口7055上的主机127.0.0.1。Firefox控制台输出"......代码和错误的截图
问题内容: 我正在运行一些selenium测试。当我直接从Eclipse启动它们时,一切正常。但是,当我通过Maven启动它们时,会发生以下异常: 我正在使用Firefox 10.0.10 ESR。我也用Selenium 2.25.0尝试过。 这是我最新的pom.xml版本: 如果我可以为您提供更多信息,请告诉我。 编辑:更新了pom.xml edit2:最让我惊讶的是,我可以从Eclipse运行