会话ID因功能/步骤

时间:2015-09-29 07:31:02

标签: c# selenium-webdriver specflow

我已经实现了Specflow来重用功能的一些步骤,如本例所示 - Specflow,Selenium-Share data between different Step definitions or classes。但是当我尝试运行已经在同一场景中的先前步骤中运行的其中一个步骤时,但是使用新的浏览器会话,抛出异常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进行菜单导航。不确定,如果这会影响,但仅作为信息。

0 个答案:

没有答案
相关问题