C# 会话ID因功能/步骤而异

C# 会话ID因功能/步骤而异,c#,selenium-webdriver,specflow,C#,Selenium Webdriver,Specflow,我已经实现了Specflow以跨功能重用一些步骤,如本例所示-。但是,当我尝试在同一场景中运行先前步骤中已运行的步骤之一,但使用新的浏览器会话时,抛出异常Selenium.WebDriver异常:无法连接到RemoteServer 在下面的功能步骤中引发异常- 如果我导航到帮助,请使用系统菜单发布 还验证了此特定步骤中的SessionID与以前的步骤不同,即当步骤-当选择特定帐户时。 已在所有步骤类文件中包含SeleniumContext的构造函数 在要素文件中 Given I navigat

我已经实现了Specflow以跨功能重用一些步骤,如本例所示-。但是,当我尝试在同一场景中运行先前步骤中已运行的步骤之一,但使用新的浏览器会话时,抛出异常Selenium.WebDriver异常:无法连接到RemoteServer

在下面的功能步骤中引发异常- 如果我导航到帮助,请使用系统菜单发布

还验证了此特定步骤中的SessionID与以前的步骤不同,即当步骤-当选择特定帐户时。 已在所有步骤类文件中包含SeleniumContext的构造函数

在要素文件中

 Given I navigate to a Help, Publish,  using the system menu
.
.
.
Given I navigate to a Help, Publish,  using the system menu
Given New Browser Launched
And Login is successful with "auto" and "ab"
And Set the service to "abcd"
Given Search a specific account to match "Account"
When A specific account is selected
Given I navigate to a Help, Publish,  using the system menu
步调一致

public MenuNavigationSteps(SeleniumContext context) {
            _driver = context.WebDriver;
        }

        [Given(@"I navigate to a (.*), (.*), (.*) using the system menu")]
        public void GivenINavigateToAUsingTheSystemMenu(string level1, string level2, string level3) {
            currentMenu = new Menu {
                Level1 = level1,
                Level2 = level2,
                Level3 = level3
            };

            var homePage = new HomePage(_driver);
            homePage.NavigateMenu(level1, level2, level3);
        }
不确定会话id在此特定步骤中更改的原因?在上一步中运行时,导航工作正常。使用Specflow+Excel进行菜单导航。不确定是否会影响,但只是作为一个信息