Selenium:与远程浏览器通信时出错。它可能已经死了

时间:2016-10-05 17:55:06

标签: java selenium selenium-webdriver

使用Selenium并尝试进行简单的测试但得到以下消息:

  

org.openqa.selenium.remote.UnreachableBrowserException:错误   与远程浏览器通信。它可能已经死了。构建信息:   版本:'未知',修订版:'c7b525d',时间:'2016-09-01 14:52:30   -0700'系统信息:主机:'LPT-ANJA01',ip:'10 .63.20.166',os.name:'Windows 7',os.arch:'amd64',os.version:'6.1',java.version :   '1.8.0_101'驱动程序信息:driver.version:RemoteWebDriver

我正在扩展一个只打开网页的基类。但后来没有任何反应。

基类:

import java.util.concurrent.TimeUnit;

import org.junit.After;
import org.junit.Before;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxProfile;
import org.openqa.selenium.firefox.internal.ProfilesIni;

public class BaseClass {
     WebDriver driver;

        @Before
        public void setUp() {

            System.setProperty("webdriver.gecko.driver","C:\\Selenium\\geckodriver.exe");

            ProfilesIni allProfiles = new ProfilesIni();
            FirefoxProfile myProfile = allProfiles.getProfile("default");
            myProfile.setAcceptUntrustedCertificates(true);
            myProfile.setAssumeUntrustedCertificateIssuer(true);
            driver = new FirefoxDriver(myProfile);

            driver.manage().window().maximize();

            driver.get("http://blahbal.com");



            }



        @After
        public void closeApplication(){

            driver.quit();

        }

}

测试类:

import static org.junit.Assert.*;

import java.util.concurrent.TimeUnit;

import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;

public class AssertTitleTest extends BaseClass {


    @Test
    public void test() {
        System.out.println(driver.getTitle());


    }

}

0 个答案:

没有答案