无法开始新会话

时间:2016-06-16 11:30:12

标签: java selenium

我正在使用selenium web驱动程序和java eclipse创建我的第一个测试脚本,每次执行下面的代码时,firefix都会打开然后停止工作

       package Newpackage;
      import org.openqa.selenium.WebDriver;
     import org.openqa.selenium.firefox.FirefoxDriver;

     public class AmrClass {
       public static void main(String[] args) {
        // declaration and instantiation of objects/variables
        try {
                WebDriver driver = new FirefoxDriver();

  //declaration of varaibles of type string
               String baseUrl = "http://newtours.demoaut.com";
               String expectedTitle = "Welcome: Mercury Tours";
            String actualTitle = "";
            //the get method will contain the baseurl varaible value
            driver.get(baseUrl);

            // get the actual value of the title
            actualTitle = driver.getTitle();
            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);
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }`

我收到以下错误:

  Could not start a new session. Possible causes are invalid address of the  
   remote server or browser start-up failure.

0 个答案:

没有答案