在Eclipse中使用Selenium WebDriver和java运行phantomjs
我一直在尝试将我的机器设置为使用Selenium WebDriver和Eclipse中的java运行phantomjs。我已经能够从命令行(使用npm在全球范围内安装)运行phantomjs,所以我很确定我只是没有通过Eclipse正确设置它
下面是我如何在测试代码中调用phantomjs的一个片段:
@Before
public void setUp() throws Exception {
dCaps = new DesiredCapabilities();
dCaps.setJavascriptEnabled(true);
dCaps.setCapability("takesScreenshot", false);
dCaps.setCapability("phantomjs.binary.path", "/usr/local/lib/node_modules/phantomjs/bin/phantomjs");
driver = new PhantomJSDriver(dCaps);
baseUrl = "http://assertselenium.com/";
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}
在从Eclipse运行测试之前,我需要手动启动phantomjs或selenium服务器吗
是否有某些文件应该包含在引导类路径中
共 (0) 个答案