java.lang.NullPointerException 在 net.sf.sahi.config.Configuration.getUserProperty

java.lang.NullPointerException at net.sf.sahi.config.Configuration.getUserProperty

这是我的代码。无法弄清楚为什么我会遇到异常。

import net.sf.sahi.client.Browser;
import org.testng.Assert;
import org.testng.annotations.Test;


public class browser {


@Test
public void function2(){
    System.out.println("Starting");
    String browserName = "firefox"; // default values are "ie", "firefox", "safari", "chrome", "opera" - specified in userdata/config/browser_types.xml
    Browser browser = new Browser(browserName);
    browser.open();
    browser.navigateTo("http://www.google.com");
    browser.textbox("q").setValue("sahi forums");
    browser.submit("Google Search").click();
    browser.link("Sahi - Web Automation and Test Tool").click();
    browser.link("Login").click();
    Assert.assertTrue(browser.textbox("req_username").exists());

    browser.close();

    System.out.println("Ending");
}
}


 import org.testng.annotations.Test;

 public class trial {

 @Test
 public void function2(){
    browser.function1();
   }
 }

我的pom.xml看起来像这样:

    <?xml version="1.0" encoding="UTF-8"?>
   <project xmlns="http://maven.apache.org/POM/4.0.0"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
     http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>rashmi</groupId>
<artifactId>sahi</artifactId>
<version>1.0-SNAPSHOT</version>


    <repositories>
        <repository>
            <id>clojars</id>
            <name>Clojars Repository</name>
            <url>http://clojars.org/repo</url>
        </repository>
    </repositories>
    <dependencies>

        <dependency>
            <groupId>sahi</groupId>
            <artifactId>sahi</artifactId>
            <version>3.5</version>
        </dependency>

        <dependency>
        <groupId>org.testng</groupId>
        <artifactId>testng</artifactId>
        <version>6.8.8</version>
    </dependency>
</dependencies>

</project>

当我右键单击我的测试并 运行 它出现 异常 我得到的结果如下:

  java.lang.NullPointerException
          at net.sf.sahi.config.Configuration.getUserProperty(Configuration.java:694)
at net.sf.sahi.config.Configuration.getCommonDomain(Configuration.java:780)
at net.sf.sahi.client.Browser.openURL(Browser.java:265)
at net.sf.sahi.client.Browser.open(Browser.java:241)
at browser.function1(browser.java:15)
at trial.function2(trial.java:12)

有人可以帮我弄清楚为什么会出现异常吗?

Browser 的 javadoc 所示,在 open.

之前,应先完成以下操作
String sahiBasePath = "D:\path\to\sahi_dir";
Sting userDataDirectory = "D:\path\to\userdata_dir";

net.sf.sahi.config.Configuration.initJava(sahiBasePath, userDataDirectory);