I am trying to navigate to a specific URL as the Given statement for an automated test case and use a DateTime.Now structure to insert a required date into the URL for the browser to navigate to, unfortunately there is currently no way around navigating this way for this specific scenario.
My gherkin is:
Scenario Outline: Search
Given I Navigate to webpage with <date>
Examples:
| Variant | Date |
| Web1 | |
| Web2 | |
| Web3 | |
| Web4 | |
| Web5 | |
My regex for the Given statement is as follows:
[Binding]
public class Search
{
[Given(@"I Navigate to WebPage with (.*)")]
public void GivenINavigateToWebpageWith(int date)
{
DateTime localDate = DateTime.Now;
String[] formats = { "yyyyMMdd" };
String[] cultureNames = { "en-US" };
DateTime date = new DateTime();
CurrentBrowserNavigation("https://webpage.com/foo/bar/blah/blah/en-us/?startdate=" + date + "&anotherThing=1");
}
I know this isn't correct and doesn't work currently but I'm a little lost as to how to properly construct this and was hoping to get pointed in the right direction by the community here. Hope this has enough detail!