Specflow and assist helpers | Selenium Webdriver Tutorial with c# |Selenium C# training

Selenium C# Training Forum

Specflow and assist helpers

A
Anita Post on 14/10/2019

fetaure file:

 

Scenario Outline: Login using valid credentials
Given I have navigated to the  application
When I have enter valid <UserName> and <Password>
And I click Login Button
Examples:
| UserName | Password |
| admin | Password@123 |
| Aagent2 | Password@123 |

 

steps file:

 

[When(@"I have enter valid (.*) and (.*)")]
public void WhenIHaveEnterValidSadminAndPassword(Table table)
{

IEnumerable<dynamic> credentials = table.CreateDynamicSet();
foreach (var users in credentials)
{
driver.FindElement(By.XPath("//input[@id='UserName']")).SendKeys(users.UserName);
Thread.Sleep(100);
driver.FindElement(By.XPath("//input[@id='Password']")).SendKeys(users.Password);
}
}

 

when I run this, it opens the browser 2 times and do not insert the username and firstname in the website.

Any help please