java应用程序即使在成功执行之后也不会终止

w9apscun  于 2021-07-06  发布在  Java
关注(0)|答案(0)|浏览(306)

终止按钮仍为红色的屏幕截图:

package seleniumProjectTutorial;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

public class SeleniumWebDriver {
    WebDriver driver;   

    public void invokeBrowser() {
        try {
            System.setProperty("webdriver.chrome.driver",
                               "D:\\Selenium\\Drivers\\chromedriver.exe");
            driver = new ChromeDriver();
            driver.manage().deleteAllCookies();
            driver.manage().window().maximize();
            driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
            driver.manage().timeouts().pageLoadTimeout(30, TimeUnit.SECONDS);
            driver.get("https://www.google.com");
            driver.close();
            driver.quit();
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {
        SeleniumWebDriver myobject = new SeleniumWebDriver();
        myobject.invokeBrowser();
    }
}

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题