I have implemented Specflow to reuse some steps across features as in this example - Specflow,Selenium-Share data between different Step definitions or classes .But when I try to run one of the steps already ran in previous steps within the same scenario,but with new browser session,throws exception Selenium.WebDriver Exception:Unable to connect to RemoteServer
Exception thrown on Feature step below - Given I navigate to a Help, Publish, using the system menu
Also verified the SessionID in this particular step has changed from previous steps, which is the When step - When A specific account is selected. Have included the constructor for SeleniumContext in all the step class files.
In feature file
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
In Steps
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);
}
Not sure why session id changes in this particular step? Its fine when run in previous step, the navigation has worked fine.Using Specflow + Excel for Menu navigation.Not sure, if that affects,but just as an information.