【发布时间】:2016-08-01 02:26:27
【问题描述】:
我需要以下组合的帮助, 操作系统:Windows 10 使用的浏览器:Firefox 45.0.1 Java版本:Java 8更新51(64位) 硒:图书馆 2.47.1 我们的代码很简单。
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.testng.annotations.Test;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.AfterClass;
import java.util.List;
import java.util.concurrent.TimeUnit;
import org.testng.Assert;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
//import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
public class TestClass01
{
static final Logger logger1 = LogManager.getLogger(TestClass01.class.getName());
WebDriver driver ;
String baseUrl ;
static int testCount = 0 ;
String[] content_heading ;
List<WebElement> temp_list ;
WebDriverWait wait;
boolean exists;
@BeforeClass
public void beforeClass()
{
logger1.entry();
logger1.info("Entering the class : " + this.getClass().getSimpleName() );
driver = new FirefoxDriver();
baseUrl = "http://www.google.com";
logger1.info("Maximizing the browser window and setting up the implicit timeout for element/page loading....");
driver.manage().window().maximize();
//Specifies the amount of time the driver should wait when searching for an element
driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);
logger1.info("Fetching the Homepage for Jacuzzi");
// launch Firefox and direct it to the Base URL
driver.get(baseUrl+"/");
}
}
但是,它会引发以下错误,
org.openqa.selenium.firefox.NotConnectedException:无法连接 45000 毫秒后在端口 7055 上托管 127.0.0.1。火狐控制台输出: 调试更新 XPIState 为 {"id":"{972ce4c6-7e08-4474-a285-3208198ce6fd}","syncGUID":"BbZlO30v46U7","location":"app-global","version":"45.0.1","type" :"theme","internalName":"classic/1.0","updateURL":null,"updateKey":null,"optionsURL":null,"optionsType":null,"aboutURL":null,"icons":{ "32":"icon.png","48":"icon.png"},"iconURL":null,"icon64URL":null,"defaultLocale":{"name":"Default","description": “这 默认 主题。","creator":"Mozilla","homepageURL":null,"contributors":["Mozilla 贡献者"]},"visible":true,"active":true,"userDisabled":false,"appDisabled":false,"descriptor":"C:\Program 文件 (x86)\Mozilla Firefox\browser\extensions\{972ce4c6-7e08-4474-a285-3208198ce6fd}.xpi","installDate":1458533973089,"updateDate":1458533973089,"applyBackgroundUpdates":1,"skinnable":true,"size":22012 ,"sourceURI":null,"releaseNotesURI":null,"softDisabled":false,"foreignInstall":false,"hasBinaryComponents":false,"strictCompatibility":true,"locales":[],"targetApplications":[{ "id":"{ec8030f7-c20a-464f-9b0e-13a3a9e97384}","minVersion":"45.0.1","maxVersion":"45.0.1"}],"targetPlatforms":[],"seen" :true}
【问题讨论】:
-
“大部分在线可用”——确实很有帮助。
-
尝试降级 ff