WebDriver Quit方法在关闭时挂起Chrome浏览器

时间:2012-06-26 10:51:34

标签: selenium webdriver selenium-chromedriver

  

可能重复:
  How to close a ChromeDriver when running on Grid?

我使用ChromeDriver打开Chrome浏览器并使用Quit()方法关闭Chrome,此时浏览器挂断并在此问题中附加错误

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

    public class test{

            public static void main(String[] args) throws InterruptedException {


System.setProperty("webdriver.chrome.driver", "C:\\chromedriver.exe");      
WebDriver driver = new ChromeDriver();      
driver.get("http://google.com");
driver.quit();


        }

    }

enter image description here

Windows上列出的这些错误挂起错误

Problem signature:
  Problem Event Name:   APPCRASH
  Application Name: chromedriver.exe
  Application Version:  0.0.0.0
  Application Timestamp:    4fe36699
  Fault Module Name:    chromedriver.exe
  Fault Module Version: 0.0.0.0
  Fault Module Timestamp:   4fe36699
  Exception Code:   80000003
  Exception Offset: 000143e0
  OS Version:   6.1.7600.2.0.0.768.2
  Locale ID:    16393
  Additional Information 1: 0a9e
  Additional Information 2: 0a9e372d3b4ad19135b953a78882e789
  Additional Information 3: 0a9e
  Additional Information 4: 0a9e372d3b4ad19135b953a78882e789

Read our privacy statement online:
  http://go.microsoft.com/fwlink/?linkid=104288&clcid=0x0409

If the online privacy statement is not available, please read our privacy statement offline:
  C:\Windows\system32\en-US\erofflps.txt

1 个答案:

答案 0 :(得分:-1)

您接下来的步骤非常好,但作为一个好习惯,请关闭与驱动程序关联的所有活动浏览器窗口,然后退出驱动程序。

在关闭浏览器窗口之前退出驱动程序时,有时会抛出异常。

在这种情况下......我会写如下

  

Driver.Close();

     

Driver.Quit();

请尝试执行以下操作,我希望Chrome错误消失:)

一切顺利。