无法连接到主机上的端口127.0.0.1 7055
我与webdriver的一个新手,需要一些帮助..无法连接到主机上的端口127.0.0.1 7055
我使用硒2.2.0在Windows XP FF V7.0.1
我已经设法在IE中成功记录和播放java脚本,但每当我尝试执行FF中的同一脚本时,我会收到以下错误消息:
无法在45000之后连接到端口7055上的主机127.0.0.1毫秒
我读过数目的地方,如果我降级f irefox版本到3.6脚本将正常工作,但我不想降级。有人可以告诉我我做错了什么吗?
package hisScripts;
import java.util.concurrent.TimeUnit;
import org.junit.*;
import static org.junit.Assert.*;
import org.openqa.selenium.*;
import org.openqa.selenium.firefox.FirefoxDriver;
public class WebdriverTest_1 {
private WebDriver driver;
private String baseUrl;
private StringBuffer verificationErrors = new StringBuffer();
@Before
public void setUp() throws Exception {
driver = new FirefoxDriver();
//driver=new InternetExplorerDriver();
baseUrl = "https://**********/";
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}
@Test
public void testUntitled() throws Exception {
driver.get(baseUrl + "/");
driver.findElement(By.xpath("//a[contains(text(),'my profile')]")).click();
driver.findElement(By.xpath("//a[contains(text(),'about the service')]")).click();
driver.findElement(By.xpath("//a[contains(text(),'contact us')]")).click();
driver.findElement(By.xpath("//a[contains(text(),'help')]")).click();
driver.findElement(By.xpath("//a[contains(text(),'home')]")).click();
driver.findElement(By.xpath("//a[contains(text(),'logout')]")).click();
}
@After
public void tearDown() throws Exception {
driver.quit();
String verificationErrorString = verificationErrors.toString();
if (!"".equals(verificationErrorString)) {
fail(verificationErrorString);
}
}
private boolean isElementPresent(By by) {
try {
driver.findElement(by);
return true;
} catch (NoSuchElementException e) {
return false;
}
}
}
您所使用的硒版本是极其古老。我不认为v2.2支持firefox 10。最新的是2.20。
看看更改日志here。从这里的笔记来看,firefox 10中的本地事件从v2.19.0开始支持,这意味着您需要2.19或更高版本才能支持Firefox 10.
感谢指出了这一点.. 原来是愚蠢的错误,我认为硒2.2.0是 一样硒2.20.0。 要纠正我下载了最新的问题'服务器'和'客户端 驱动程序'(在我的情况Java)从http://seleniumhq.org/download/和 猜想它的工作原理:) – user929258 2012-04-05 08:48:39
在Rails环境中,这可能意味着升级硒服务器的jar用于运行远程服务器以及升级服务器使用的gem。我有后者,但忘记了前者也需要升级。 – andy 2012-06-26 15:04:28
我在版本2.24.X中遇到类似问题。所以我改为2.25.0。谢谢。 – dbalakirev 2012-10-13 11:15:36
此问题是由于fire fox版本和硒jar文件版本的兼容性使用最新的硒jar文件,可以解决这个问题。
代码没问题。升级怎么样?从FF7到FF9还是10? Selenium无法与FF11一起工作(迄今为止),但FF9正常工作! – 2012-04-04 15:47:08
@slanec - 我已经升级到FFv10.0.2,但仍然没有喜悦 - 我还有什么可以解决这个问题吗? – user929258 2012-04-04 16:50:44
绝对不知道=( – 2012-04-04 17:09:11