2016-01-12 44 views
0

我有以下代码:硒 - 芯Java错误

public static void main(String[] args) { 
    WebDriver wd = new FirefoxDriver(); 
    wd.get("https://www.wordpress.com/"); 
} 

没有与此编译时错误,但只要打开Mozilla的,它说:“此连接不可信”。我希望打开我在代码中指定的网址。 “主” 显示java.lang.NullPointerException \t在selePackage.Demo 异常螺纹 - :

回答

0

打开Firefox司机这样的 -

ProfilesIni allProfiles = new ProfilesIni(); 
System.setProperty("webdriver.firefox.profile","your custom firefox profile name"); 
String browserProfile = stem.getProperty("webdriver.firefox.profile"); 
FirefoxProfile profile = allProfiles.getProfile(browserProfile); 
profile.setAcceptUntrustedCertificates (true); 
webdriver = new FirefoxDriver(profile); 
+0

有了这个代码,我得到一个运行时错误,如下所示。 main(Demo.java:33) –

+0

哪一行是第33行? –

+0

33行是:myProfile.setAcceptUntrustedCertificates(true); –