Selenium是否有这样的功能,可以在任何属性文件中提到selenium服务器配置,在启动服务器之前,它会自动从该属性文件中读取属性并相应地执行,即它可以在具有不同端口的不同机器上执行多个实例、不同的浏览器。我知道我们可以通过编程或通过json或命令提示符进行配置。
现在,我正在手动编写一个属性文件,以编程方式读取它,并以编程方式配置selenium服务器。
我正在使用这些方法配置selenium,
Properties properties = new Properties();
DesiredCapabilities capability = DesiredCapabilities.firefox();
capability.setBrowserName(properties.get("Browser"));
capability.setVersion(properties.get("Version"));
capability.setPlatform(Platform.valueOf(properties.get("Platform")));
selenium = new DefaultSelenium(properties.get("Host"), Integer.parseInt(properties.get("Port")), properties.get("browser") ,url);
seleniumserver.start();
selenium.start();我想要的是,如果selenium提供了一个功能,它可以读取属性文件,配置功能,主机等,然后它只需调用seleniumserver.start()和selenium.start()来运行服务器,而不是做所有这些。
发布于 2012-11-06 20:29:49
据我所知没有这样的功能。最好的选择就是手动编写,就像现在一样。
在以前的项目中,我创建了一个configuration类,它读取/接收selenium参数,然后作为有关配置的任何查询的单例。
https://stackoverflow.com/questions/13249252
复制相似问题