无法实例化FirefoxDriver类型

时间:2017-01-23 15:46:39

标签: java eclipse selenium webdriver

似乎可以让这段代码执行。编译器没有实例化驱动程序。我该怎么做才能纠正这个问题。

package mypackage;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.Select;

org.openqa.selenium.support.ui.ExpectedConditions;
import 

org.openqa.selenium.support.ui.WebDriverWait;

public class selenium {

    public static void main(String[] args) {
        WebDriver driver = (WebDriver) new FirefoxDriver();
        WebDriverWait MyWaitlVar= new  

WebDriverWait(driver, 10);
        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);
    }

}

0 个答案:

没有答案