线程" main"中的例外情况org.openqa.selenium.remote.UnreachableBrowserException:与远程浏览器通信时出错

时间:2016-06-08 06:53:06

标签: java selenium selenium-webdriver

当我执行下面的代码时,错误应该在那里:

  

线程中的异常" main"   org.openqa.selenium.remote.UnreachableBrowserException:错误   与远程浏览器通信。它可能已经死了。构建信息:   版本:' 2.53.0',修订版:' 35ae25b',时间:' 2016-03-15 16:57:40'

我的代码如下:

import java.util.concurrent.TimeUnit;

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.browserlaunchers.locators.*;


public class Login {

    public static void main(String[] args) {

        WebDriver driver = new FirefoxDriver();
        String baseUrl = " http://10.37.55.109/Exide_Esam/admin.html";
        driver.get(baseUrl);
        driver.findElement(By.id("txtUser")).sendKeys("ZASADMIN");
        driver.findElement(By.id("txtPass")).sendKeys("Test");
        WebElement checkbox;
        checkbox = driver.findElement(By.className("checkbox-material"));
        if(!checkbox.isSelected())
        {
            checkbox.click();
        }
        driver.findElement(By.id("btnLogin")).click();
        driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);
        driver.findElement(By.xpath("//span[text()=' Master']")).click();
        driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);

        driver.findElement(By.xpath("//div[@class = 'mobile-view `enter code here`visible-xs']//ul[@class = 'sub-menu-list']//li[@id = 'SubMenu-1']")).click();

        driver.quit();  

0 个答案:

没有答案