更换镀铬驱动器后的配置faliure

时间:2016-10-26 10:06:53

标签: java google-chrome selenium selenium-chromedriver

我正在使用selenium webdriver进行自动化。当我运行测试时,我的chrome驱动程序突然崩溃了。然后我删除chromedriver.exe并下载最新的一个并替换目标文件夹和驱动程序文件夹。重建项目并再次运行.project正在构建没有错误。但铬没有打开。 它会引发错误,如下:

FAILED CONFIGURATION:@BeforeMethod openBrowser([Ljava.lang.Object; @ 15bbf42f) java.lang.NoSuchMethodError:org.slf4j.impl.StaticLoggerBinder.getSingleton()Lorg / slf4j / impl / StaticLoggerBinder;

无法弄清楚错误在哪里。感谢您的支持。

在课前代码中查找:

@BeforeMethod
    public void openBrowser(Object[] testArgs) throws Exception {
        try {
            logInstruction("LOG INSTRUCTION: Open the browser");
            String dateTime;
            File downLoadDir;
            Date date;
            DateFormat dateFormat;
            String dateExe = getDate();
            writeToOutPut("===================");
            writeToOutPut(dateExe);

            switch (browser) {

                case FIREFOX:
                    FirefoxProfile profile = new FirefoxProfile();
                    profile.setPreference(
                            "capability.policy.default.Window.QueryInterface",
                            "allAccess");
                    profile.setPreference(
                            "capability.policy.default.Window.frameElement.get",
                            "allAccess");
                    profile.setPreference("browser.download.folderList", 2);
                    profile.setPreference("browser.download.manager.showWhenStarting", false);
                    profile.setPreference("browser.download.manager.showAlertOnComplete", false);
                    profile.setPreference("browser.helperApps.neverAsk.saveToDisk", "image/jpeg�");
                    //profile.setPreference("browser.download.dir", downloadPath);
                    uiDriver = new DefaultUIDriver(profile);
                    break;
                    case CHROME:
                    ChromeOptions options = new ChromeOptions();
                    options.addArguments("start-maximized");
                    options.addArguments("test-type");
                    options.addArguments("disable-extensions");
           Field f = options.getClass().getDeclaredField("experimentalOptions");
                    f.setAccessible(true);
                    Map<String, Object> expOpts = (Map<String, Object>) f.get(options);
                    expOpts.put("prefs", settings);

                    DesiredCapabilities capabilities = DesiredCapabilities.chrome();
                    capabilities.setCapability(ChromeOptions.CAPABILITY, options);

                    uiDriver = new DefaultUIDriver(capabilities);
                   // downloadPath = "/AutomationChromeDownloads/" + dateTime;
                    break;

                case INTERNETEXPLORER:
                    downloadPath = config.getValue("defaultDownLoadPath_IE");

                    uiDriver = new DefaultUIDriver(Browser.INTERNETEXPLORER);

                    break;
            }
            uiDriver.manage().deleteAllCookies();
            startURL = (String) testArgs[1];
            uiDriver.get(startURL);
            uiDriver.manage().window().maximize();
        } catch (Exception e) {
            throw new Exception(e.getMessage());
        }

    }

find the image to find error

0 个答案:

没有答案