首页 > 解决方案 > 当我们尝试使用配置文件启动 Firefox 浏览器时,它没有启动

问题描述

We'd like to  launch the Firefox browser with profile initialization . but it is not opening and failing with below error message.

“java.lang.NoClassDefFoundError:org/openqa/selenium/remote/JsonToBeanConverter”在 org.openqa.selenium.firefox.Preferences.readDefaultPreferences(Preferences.java:95)

 **My current software version details** 
Selenium 3.14
Firefox browser 66
Gecko driver version V 0.24


System.setProperty("webdriver.gecko.driver", "C:\\geckodriver.exe");
ProfilesIni prof = new ProfilesIni();
FirefoxProfile profile = prof.getProfile("Auto");
DesiredCapabilities capabilities = DesiredCapabilities.firefox();
capabilities.setCapability(FirefoxDriver.PROFILE, profile);
return new FirefoxDriver(capabilities);


I tried to launch the Firefox browser with above configuration 
 As per the above code we have created a profile manually and trying to launch the browser with created profile . We have added add block plus plugin in the profile. because Random popup is appearing in our application . so we want to block it by adding the random popup filename is the add block plus filter.

**Actual Result :**Browser is not launching 
**Expected Result :**Browser should launch

标签: seleniumfirefoxaddprofile

解决方案


您的 pom.xml 显示您正在使用不支持 geckodriver 0.24 的 Selenium 版本 3.14.0;尝试更新到 selenium 版本3.141.59,您应该只需要以下 selenium 依赖项:

        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-remote-driver</artifactId>
            <version>3.141.59</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>3.141.59</version>
            <scope>test</scope>
        </dependency>

推荐阅读