1

我正在尝试关闭driver.close()在 Selenium3 中使用的浏览器。但它不起作用。请帮帮我

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

public class Test {

    public static void main(String[] args) {

        System.setProperty("webdriver.gecko.driver", "E:\\Phani\\Tools\\geckodriver.exe");

        WebDriver wd = new FirefoxDriver();
        wd.get("https://google.com");
        try{
        wd.close();
        }catch(Exception e){
            System.out.println("---------------------------------------------");
            System.out.println(e.getMessage());
            System.out.println("---------------------------------------------");
            //System.out.println(e.getStackTrace());

        }
    }

}

在 close() 期间出现以下错误。

---------------------------------------------
Failed to interpret value as array
Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
System info: host: 'PCNAME-PC', ip: '192.168.0.105', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_131'
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{rotatable=false, raisesAccessibilityExceptions=false, appBuildId=20160623154057, version=47.0.1, platform=XP, proxy=Proxy(), command_id=1.0, specificationLevel=0.0, acceptSslCerts=false, browserVersion=47.0.1, platformVersion=6.1, XULappId={ec8030f7-c20a-464f-9b0e-13a3a9e97384}, browserName=Firefox, takesScreenshot=true, takesElementScreenshot=true, javascriptEnabled=true, platformName=Windows_NT, device=desktop}]
Session ID: b5fa76b7-80b1-49d1-806e-cee7032259ef
---------------------------------------------
4

1 回答 1

1

我没有看到您在代码中执行任何其他测试,因此您可以使用 close() 代替wd.quit();

于 2017-04-29T16:34:01.733 回答