在线程“主”中获取异常java.lang.NullPointerException 错误一次又一次,
我该怎么办? 这是代码
私有静态最终字符串FIREFOX_OPTIONS = null;
@SuppressWarnings("deprecation")
public static void main(String[] args) throws InterruptedException {
DesiredCapabilities capabilities = DesiredCapabilities.firefox();
ProfilesIni init = new ProfilesIni();
FirefoxProfile profile = init.getProfile("default");
profile.setPreference("general.useragent.override","Mozilla/5.0 (Linux; Android 6.0.1; Nexus 6P Build/MMB29P) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.83 Mobile Safari/537.36");
FirefoxOptions options = new FirefoxOptions().setProfile(profile);
capabilities.setCapability(FirefoxDriver.PROFILE, profile);
options.addArguments("-private");
options.addArguments("start-maximized");
capabilities.setCapability(FirefoxOptions.FIREFOX_OPTIONS, options);
System.setProperty("webdriver.gecko.driver","C:\\Users\\abc\\Downloads\\geckodriver.exe");
WebDriver driver = null;
while(true) {
try {
driver = new FirefoxDriver(capabilities);
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);