Say I have a scenario that uses steps that are contained in two different classes.
(假设我有一个使用两个不同类中包含的步骤的方案。)
Is there a way for both of them to have a handle to the same IWebDriver
instance without going through ScenarioContext.Current["webdriverVariableName"]
? (有没有办法让他们两个都拥有相同的IWebDriver
实例的句柄而无需通过ScenarioContext.Current["webdriverVariableName"]
?)
That's so ugly.
(太丑了)
Is there a cleaner way? (有没有更清洁的方法?)
I was going to make a class with a public static IWebDriver
property that gets assigned at the start of every scenario, so that all my steps could refer to it, but I don't think that will work when I start to run them in parallel, as each scenario would overwrite the global driver.
(我打算创建一个带有public static IWebDriver
属性的类, public static IWebDriver
将在每种情况的开始时分配,以便我的所有步骤都可以引用它,但是当我开始并行运行它们时,我认为这种方法不起作用,因为每种情况都会覆盖全局驱动程序。)
ask by user1738509 translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…