运行Selenium WebDriver时出错

时间:2018-03-17 07:46:43

标签: java selenium

运行Selenium WebDriver代码时,收到以下错误消息。

  

Microsoft Windows恶意软件删除工具 - ...想要将Chrome设置恢复为原始默认设置

这是我正在使用的代码。

 package snaptrude;
    import org.openqa.selenium.WebDriver;   
    import org.openqa.selenium.chrome.ChromeDriver;

    public class MyProject {

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

            System.setProperty("webdriver.chrome.driver","C:\\Users\\Kunal\\Desktop\\Selenium\\chromedriver_win32\\chromedriver.exe");
            WebDriver driver = new ChromeDriver();

            String baseUrl = "http://demo.guru99.com/test/newtours/";
            String expectedTitle = "Welcome: Mercury Tours";
            String actualTitle = "";

            // launch Fire fox 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 with 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 Fire fox
            driver.close();

        }
    }

0 个答案:

没有答案