Java 属性文件未正确加载 当在中间运行我所有的脚本时,获得 Null PoExtExtExc< /Cord>。我在属性文件中写入了xpath,并且正在BeforeSuite中加载属性文件。元素将出现,页面也将出现。在定位器中获取null。

Java 属性文件未正确加载 当在中间运行我所有的脚本时,获得 Null PoExtExtExc< /Cord>。我在属性文件中写入了xpath,并且正在BeforeSuite中加载属性文件。元素将出现,页面也将出现。在定位器中获取null。,java,selenium,Java,Selenium,可能是您的属性文件没有给出元素的确切值。 请尝试通过提供属性名来调用此函数 public static String getProperty(String propertyname) { Properties prop = new Properties(); InputStream input = null; try { input = new FileInputStream(("path of your prope

可能是您的属性文件没有给出元素的确切值。 请尝试通过提供属性名来调用此函数

public static String getProperty(String propertyname)
    {
        Properties prop = new Properties();
        InputStream input = null;
        try {
            input = new FileInputStream(("path of your property file"));

            // load a properties file
            prop.load(input);
        } catch (IOException ex) {
            ex.printStackTrace();
        } finally {
            if (input != null) {
                try {
                    input.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
        System.out.println(prop.getProperty(propertyname));
        //Return the property value
        return prop.getProperty(propertyname);

    } 

现在,是阅读提问指南的时候了。