我需要将项目列表放入 Scenario.Context。例如我有
IList<IWebElement> test = Driver.FindElements(By.XPath(""));
它每次都会返回多个值,现在如果我希望它存储在 Scenario.Context 中,我该怎么做?
我需要将项目列表放入 Scenario.Context。例如我有
IList<IWebElement> test = Driver.FindElements(By.XPath(""));
它每次都会返回多个值,现在如果我希望它存储在 Scenario.Context 中,我该怎么做?
请参阅 ScenarioContext 范围的示例: https ://github.com/techtalk/SpecFlow/wiki/ScenarioContext.Current
对于功能范围,它是相似的
存储:ScenarioContext.Current.Add(name, test);
使用:
IList < IWebElement > test = (IList < IWebElement >) ScenarioContext.Current[name];