我正在使用Selenium Webdriver和Cucumber-js编写端到端测试。现在,我将驱动程序实例附加到黄瓜“ world”上,如下所示:
function CustomWorld({attach, parameters}) {
this.driver = new seleniumWebdriver.Builder()
.forBrowser('chrome')
.build();
}
setWorldConstructor(CustomWorld)
这使我可以在步骤定义中调用驱动程序上的方法。不幸的是,这还会为每种情况重新打开一个新的浏览器会话。我希望能够编写必要时重用浏览器会话的测试,有人知道这样做的方法吗?