2016-09-20 29 views
0

铬试图在下面的代码我得到UnhandledBrowserException:UnReachableBrowserException在丁目硒的webdriver

公共MyClass类{

public static void main(String[] args) { 
    // declaration and instantiation of objects/variables 

    System.setProperty("webdriver.chrome.driver", "C://Program Files (x86)//Google//Chrome//Application//chrome.exe"); 
    WebDriver driver= new ChromeDriver(); 


    String baseURL = "http://newtours.demoaut.com"; 
    String expectedTitle = "Welcome: Mercury Tours"; 
    String actualTitle = ""; 

    // launch Firefox and direct it to the Base URL 
    driver.get(baseURL); 
    // get the actual value of the title 
    actualTitle = driver.getTitle(); 

    /* 
    * compare the actual title of the page witht the expected one and print 
    * the result as "Passed" or "Failed" 
    */ 
    if (actualTitle.contentEquals(expectedTitle)){ 
     System.out.println("Test Passed!"); 
    } else { 
     System.out.println("Test Failed"); 
    } 

    //close Firefox 
    driver.close(); 

    // exit the program explicitly 
    System.exit(0); 
} 

它推出Chrome新会话,但随后抛出异常。任何帮助将不胜感激。

+0

的[UnreachableBrowserException尝试使用IEDriver中硒的webdriver推出]可能的复制(http://stackoverflow.com/questions/17066424/unreachablebrowserexception-trying-to-launch-in-selenium- webdriver-using-iedrive) – Guy

+0

发布异常总是很好。 – SkorpEN

回答